Download the PHP package locomotivemtl/charcoal-user without Composer
On this page you can find all versions of the php package locomotivemtl/charcoal-user. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download locomotivemtl/charcoal-user
More information about locomotivemtl/charcoal-user
Files in locomotivemtl/charcoal-user
Package charcoal-user
Short Description User definition, authentication and authorization.
License MIT
Informations about the package charcoal-user
Charcoal User
User defintion (as Charcoal Model), authentication and authorization (with Laminas ACL).
Table of content
- How to install
- Dependencies
- The User object
- Authentication
- Authorization
- Development
- Development dependencies
- Continuous Integration
- Coding Style
- Authors
How to install
The preferred (and only supported) way of installing charcoal-user is with composer:
Dependencies
- PHP 7.1+
laminas/laminas-permissions-acllocomotivemtl/charcoal-object
The User object
At the core of this module is the definition of a "User" object. The contract can be found as \Charcoal\User\UserInterface. This interfaces extends \Charcoal\Object\ContentInterface (from locomotivemtl/charcoal-object), which extends \Charcoal\Model\ModelInterface (from locomotivemtl/charcoal-core).
The preferred way of using this module is by defining your own User class in your project and extending the provided \Charcoal\User\AbstractUser class.
For quick prototypes or small projects, a full concrete class is provided as \Charcoal\User\GenericUser.
User properties
| Property | Type | Default | Description |
|---|---|---|---|
| username | string |
true |
… |
| password | string |
null |
… |
string |
null |
… | |
| roles | string[] |
[] |
ACL roles, which define user permissions. |
| last_login_date | date-time |
null |
… |
| last_login_ip | string |
'' |
… |
| last_password_date | date-time |
null |
… |
| last_password_ip | string |
'' |
… |
| login_token | string |
null |
… |
Note that the
keyof the User is theusername. Therefore,id()returns the username. It must be unique.
Properties inherited from Content-Interface:
| Property | Type | Default | Description |
|---|---|---|---|
| active | boolean |
true |
… |
| position | number |
null |
… |
| created | date-time |
null |
… |
| created_by | string |
'' |
… |
| last_modified | date-time |
null |
… |
| last_modified_by | string |
'' |
… |
Authentication
...
Authentication Examples
...
Authorization
User authorization is managed with a role-based Access Control List (ACL). Internally, it uses laminas/laminas-permissions-acl for the ACL logic. It is recommended to read the Laminas ACL documentation to learn more about how it all works.
There are 2 main concepts that must be managed, either from JSON config files or in the database (which works well with locomotivemtl/charcoal-admin), roles and permissions.
ACL Configuration
To set up ACL, it is highly recommended to use the \Charcoal\User\Acl\Manager.
ACL Example
Development
To install the development environment:
To run the scripts (phplint, phpcs and phpunit):
API documentation
- The auto-generated
phpDocumentorAPI documentation is available at https://locomotivemtl.github.io/charcoal-user/docs/master/ - The auto-generated
apigenAPI documentation is available at https://codedoc.pub/locomotivemtl/charcoal-user/master/
Development dependencies
phpunit/phpunitsquizlabs/php_codesniffersatooshi/php-coveralls
Continuous Integration
| Service | Badge | Description |
|---|---|---|
| Travis | Runs code sniff check and unit tests. Auto-generates API documentation. | |
| Scrutinizer | ![]() |
Code quality checker. Also validates API documentation quality. |
| Coveralls | Unit Tests code coverage. | |
| Sensiolabs | ![]() |
Another code quality checker, focused on PHP. |
Coding Style
The charcoal-user module follows the Charcoal coding-style:
- PSR-1
- PSR-2
- PSR-4, autoloading is therefore provided by Composer.
- phpDocumentor comments.
- Read the phpcs.xml file for all the details on code style.
Coding style validation / enforcement can be performed with
composer phpcs. An auto-fixer is also available withcomposer phpcbf.This module should also throw no error when running
phpstan analyse -l7 src/👍.
Authors
- Mathieu Ducharme, [email protected]
- Chauncey McAskill
- Locomotive, a Montreal Web agency
License
Charcoal is licensed under the MIT license. See LICENSE for details.
All versions of charcoal-user with dependencies
psr/log Version ^1.0
laminas/laminas-permissions-acl Version ^2.7
locomotivemtl/charcoal-object Version ~0.7
locomotivemtl/charcoal-config Version ~0.10
locomotivemtl/charcoal-factory Version ~0.4
locomotivemtl/charcoal-core Version ~0.4
locomotivemtl/charcoal-translator Version ~0.3

