PHPackages                             appzcoder/laravel-roles - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. appzcoder/laravel-roles

Abandoned → [appzcoder/laravel-admin](/?search=appzcoder%2Flaravel-admin)Library[Authentication &amp; Authorization](/categories/authentication)

appzcoder/laravel-roles
=======================

Laravel 5 User Role Manager

61015PHP

Since Aug 24Pushed 10y ago2 watchersCompare

[ Source](https://github.com/appzcoder/laravel-roles)[ Packagist](https://packagist.org/packages/appzcoder/laravel-roles)[ RSS](/packages/appzcoder-laravel-roles/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Roles
=============

[](#laravel-roles)

Laravel 5 User Role Manager

The idea of this package came from laracast [laracasts/Users-and-Roles-in-Laravel](https://github.com/laracasts/Users-and-Roles-in-Laravel) and now it is built for laravel 5.

### Requirements

[](#requirements)

```
Laravel >=5.1
PHP >= 5.5.9

```

Installation
------------

[](#installation)

1. Run

    ```
    composer require "appzcoder/laravel-roles":"dev-master"

    ```
2. Add service provider into **/config/app.php** file.

    ```
    'providers' => [
        ...

        Appzcoder\LaravelRoles\LaravelRolesServiceProvider::class,
    ],
    ```
3. Publish migrations

    ```
    php artisan vendor:publish

    ```
4. Run migrate command

    ```
    php artisan migrate

    ```
5. Include **UserRoles** trait to your **user model** located at **/app/User.php**

    ```
    use Appzcoder\LaravelRoles\Traits\UserRoles;

    class User extends Model implements AuthenticatableContract, CanResetPasswordContract
    {
        use Authenticatable, CanResetPassword, UserRoles;
    ```

Usage
-----

[](#usage)

Use the routes as bellow.

```
Route::get('/roles', function () {

    /* Create user if needed
    App\User::create([
    'name' => 'Sohel Amin',
    'email' => 'sohelamincse@gmail.com',
    'password' => bcrypt('123456'),
    ]);
     */

    $user = App\User::first();

    /* Create roles
    $role = new Appzcoder\LaravelRoles\Models\Role;
    $role->name = 'admin';
    $role->save();
     */

    /* Assign and remove role from user
    $role = Appzcoder\LaravelRoles\Models\Role::whereName('admin')->first();
    $user->assignRole($role);
    //$user->removeRole(2);
     */

    return $user->roles;
});

Route::get('/admin', ['middleware' => 'role:admin', 'uses' => 'AdminController@index']);
```

\##Author

[Sohel Amin](http://www.sohelamin.com)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/beed541009d742df2fff23fc2fc82af84b0decfa90439ba512c4d98b3d24c118?d=identicon)[appzcoder](/maintainers/appzcoder)

---

Top Contributors

[![sohelamin](https://avatars.githubusercontent.com/u/1708683?v=4)](https://github.com/sohelamin "sohelamin (20 commits)")

### Embed Badge

![Health badge](/badges/appzcoder-laravel-roles/health.svg)

```
[![Health](https://phpackages.com/badges/appzcoder-laravel-roles/health.svg)](https://phpackages.com/packages/appzcoder-laravel-roles)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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