Download the PHP package maatwebsite/usher without Composer
On this page you can find all versions of the php package maatwebsite/usher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package usher
Usher
A Doctrine ACL package for Laravel 5
- Login with Doctrine User entity
- User roles
- User banning
- User suspending
- User permissions
- User last login and last attempt event listeners
- Role permissions
Installation
Include the service provider in config/app.php
Config
To change the defaults of this package, publish the config:
Default usage
Out of the box, you can use the ACL system without defining your own entities. However this is not recommended!
Custom usage
For example if you want a Customer
and Group
entity, you just have to make sure it implements Maatwebsite\Usher\Contracts\Users\User
. If you want a faster solution, you can optionally extend the MappedSuperclass Maatwebsite\Usher\Domain\Users\User
.
*Note that you will have to define the roles relation yourself.
Example with the MappedSuperclass:
Same as with the User
MappedSuperclass, you'll have to define the User relation yourself.
Next you'll have to update the class reference in config/usher.php
for the user.entity
en role.entity
Events
Domain Events
Domain Event | When |
---|---|
UserGotAssignedToRole | $user->assignRole($role) |
UserGotBanned | $user->ban() |
UserGotRemovedFromRole | $user->removeRole($role) |
UserGotSuspended | $user->suspend($minutes) |
UserRegistered | $user->register() |
UserUpdatedProfile | $user->update() |
RoleWasCreated | $role->create() |
RoleWasUpdated | $role->update() |
Event Listeners
Event listeners can be enabled and disabled inside the config. By default the listed listenes are all enabled.
Listener | When |
---|---|
SaveLastAttemptDate | auth.attempt |
CheckIfUserIsBanned | auth.attempt |
CheckIfUserIsSuspended | auth.attempt |
SaveLastLoginDate | auth.login |