The Ellingham Tech User System for PHP
There are already many solutions out that offer user management in PHP. But a majority of them are lacking key features or come with a load of headaches.
Some projects don't fit a framework or CMS that comes with user management. Others need much more flexibility that what is offered. We had these problems and this was our solution.
The User System for PHP is a library, not a framework. It provides a static class,
UserSystem, that controls the core functionality and a
UserFactory to help out with creating some of the core objects.
Extensive feature set
We've built in many features. Some of which are required, others you simply don't need to worry about if your project doesn't need them.
- User Accounts (register, login, forgot password features)
- User Permissions (Read, Write, Execute, Modify, Delete + custom permissions)
- User Limits (similar to permissions, but when you need a limit...)
- User Tokens (for forgot-password, email verification, etc)
- User Preference (store preferences for your users!)
- User Profiles (a public profile for your users, using a profile ID)
- User Meta (store additional data for the user, such as backup email address)
Not a framework
The User System library is not designed to be 100% out-of-the-box. Things like two-factor auth, forgot password emails, etc, will still need to be sent by your own script. The library will provide the necessary tokens and details but everything else is down to you.
You have full control.
Everything works with objects and a factory.
$newUser = UserFactory::newUser(); $newUser->user_name = 'joe_bloggs'; $newUser->setPassword('bloggyblogblog'); $success = $newUser->save(); $permission = $newUser->getUserPermission('posts'); $canPost = $permission->hasPermission('rw'); $postLimit = $newUser->getUserLimit('posts'); $withinLimit = $newUser->isWithinLimit();
Setting it up is simple. Using an SQL connection (MySQL or SQLite, others not yet tested), just call the
init method on the UserSystem:
The database must be using one of the Wrappers provided in the PHPHelpers library. You don't need to create a new connection or rewrite your existing database commends if you are already using PDO, simply do the following:
$database = new EllinghamTech\Database\SQL\Wrapper(); $database->useExistingConnection($pdoObject); UserSystem::init($database);
For more information, view the library on GitHub: https://github.com/EllinghamTech/UserSystemForPHP