PHPackages                             maatwebsite/usher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. maatwebsite/usher

Abandoned → [laravel-doctrine/orm](/?search=laravel-doctrine%2Form)ArchivedLibrary[Database &amp; ORM](/categories/database)

maatwebsite/usher
=================

A Doctrine ACL package for Laravel

1.0.3(6y ago)72.7k3MITPHPPHP &gt;=5.4.0

Since May 3Pushed 6y ago6 watchersCompare

[ Source](https://github.com/Maatwebsite/Usher)[ Packagist](https://packagist.org/packages/maatwebsite/usher)[ RSS](/packages/maatwebsite-usher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (0)

Usher
=====

[](#usher)

### A Doctrine ACL package for Laravel 5

[](#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
------------

[](#installation)

Include the service provider in `config/app.php`

```
'Brouwers\LaravelDoctrine\DoctrineServiceProvider',
'Maatwebsite\Usher\UsherServiceProvider'
```

Config
------

[](#config)

To change the defaults of this package, publish the config:

```
php artisan vendor:publish --provider="Maatwebsite\Usher\UsherServiceProvider"
```

Default usage
-------------

[](#default-usage)

Out of the box, you can use the ACL system without defining your own entities. However this is not recommended!

Custom usage
------------

[](#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:

```
use Doctrine\ORM\Mapping as ORM;
use Maatwebsite\Usher\Domain\Users\User;
use Maatwebsite\Usher\Contracts\Users\User as UserInterface;

/**
 * @ORM\Entity(repositoryClass="DoctrineCustomerRepository")
 * @ORM\Table(name="customers")
 * @ORM\HasLifecycleCallbacks()
 */
class Customer extends User implements UserInterface
{
    /**
     * @ORM\ManyToMany(targetEntity="Group", inversedBy="customers")
     * @ORM\JoinTable(name="customer_groups")
     * @var ArrayCollection|\App\Domain\Customers\Entities\Role[]
     */
    protected $groups;

    /**
     * Customer Constructor
     */
    public function __construct()
    {
        $this->groups = new ArrayCollection();
    }

    /**
     * @return ArrayCollection|\Maatwebsite\Usher\Contracts\Roles\Role[]
     */
    public function getRoles()
    {
        return $this->groups;
    }
  }
```

Same as with the `User` MappedSuperclass, you'll have to define the User relation yourself.

```
/**
 * @ORM\Entity(repositoryClass="DoctrineRoleRepository")
 * @ORM\Table(name="groups")
 * @ORM\HasLifecycleCallbacks()
 */
class Group extends Role implements RoleInterface
{

    /**
     * @ORM\ManyToMany(targetEntity="Customer", mappedBy="groups")
     * @var ArrayCollection|Customer[]
     **/
    protected $customers;

    /**
     * Role Constructor
     */
    public function __construct()
    {
        $this->customers = new ArrayCollection();
    }

    /**
     * @return ArrayCollection|\Maatwebsite\Usher\Contracts\Users\User[]
     */
    public function getUsers()
    {
        return $this->customers;
    }
}
```

Next you'll have to update the class reference in `config/usher.php` for the `user.entity` en `role.entity`

```
return [
    'users'  => [
        'entity' => 'Customer'
    ],
    'roles'  => [
        'entity' => 'Group'
    ]
]
```

Events
------

[](#events)

### Domain Events

[](#domain-events)

Domain EventWhenUserGotAssignedToRole`$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)

Event listeners can be enabled and disabled inside the config. By default the listed listenes are all enabled.

ListenerWhenSaveLastAttemptDate`auth.attempt`CheckIfUserIsBanned`auth.attempt`CheckIfUserIsSuspended`auth.attempt`SaveLastLoginDate`auth.login`

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~524 days

Total

4

Last Release

2398d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20562729?v=4)[spartner](/maintainers/spartner)[@spartner](https://github.com/spartner)

---

Top Contributors

[![patrickbrouwers](https://avatars.githubusercontent.com/u/7728097?v=4)](https://github.com/patrickbrouwers "patrickbrouwers (55 commits)")

---

Tags

laravelormdoctrineaclrolesUsers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maatwebsite-usher/health.svg)

```
[![Health](https://phpackages.com/badges/maatwebsite-usher/health.svg)](https://phpackages.com/packages/maatwebsite-usher)
```

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[laravel-doctrine/acl

ACL for Laravel and Doctrine

44445.3k7](/packages/laravel-doctrine-acl)[kodeine/laravel-acl

Light-weight role-based permissions for Laravel 5 built in Auth system.

782354.8k5](/packages/kodeine-laravel-acl)[laravel-doctrine/fluent

A fluent PHP mapping driver for Doctrine2.

43430.3k13](/packages/laravel-doctrine-fluent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
