PHPackages                             abdul/laravel-role-permission - 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. abdul/laravel-role-permission

Abandoned → [abdul/laravel-role-permission](/?search=abdul%2Flaravel-role-permission)Laravel-package

abdul/laravel-role-permission
=============================

Laravel routes permission configurable from backend

v1.0.1(5y ago)014MITPHP

Since Aug 1Pushed 4y agoCompare

[ Source](https://github.com/abdulwahhabkhan/laravel-role-permission)[ Packagist](https://packagist.org/packages/abdul/laravel-role-permission)[ RSS](/packages/abdul-laravel-role-permission/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Role Permission
=======================

[](#laravel-role-permission)

[![Packagist Version](https://camo.githubusercontent.com/1629a7870c914e29ec9b3f3b7529fcc59b7e4552b5a8a9e38c20e955af8d5e9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)](https://camo.githubusercontent.com/1629a7870c914e29ec9b3f3b7529fcc59b7e4552b5a8a9e38c20e955af8d5e9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)[![Packagist License](https://camo.githubusercontent.com/4bbef23c253a001e8c9ec311e78bf737c923ef6229dd5d6587507caf3f6e5654/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)](https://camo.githubusercontent.com/4bbef23c253a001e8c9ec311e78bf737c923ef6229dd5d6587507caf3f6e5654/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)[![Packagist Downloads](https://camo.githubusercontent.com/81649b00728419f1dce585037c263dbc2b01c5662dcf315e33b407bd413e0ef5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)](https://camo.githubusercontent.com/81649b00728419f1dce585037c263dbc2b01c5662dcf315e33b407bd413e0ef5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264756c2f6c61726176656c2d726f6c652d7065726d697373696f6e)

An easy and flexible Laravel roles and permissions management for admin.

This package basic idea is based on [(amiryousefi/laravel-permission)](https://github.com/amiryousefi/laravel-permission) module.

Why we need a Laravel permission package
----------------------------------------

[](#why-we-need-a-laravel-permission-package)

In many projects, we need to implement a role-based permissions management system for our clients. This will make the development and controlling the access management easy for web projects built on Laravel.

### How add permissions via admin panel

[](#how-add-permissions-via-admin-panel)

After installation if you visit the route [Roles From](http://127.0.0.1:8000/config/role/create) All routes belongs to `auth.role` middleware will appear, you can add to role according to your application needs

[![role form](role-form.jpg?raw=true)](role-form.jpg?raw=true)

How to use
----------

[](#how-to-use)

The idea is to use this package as easy and as flexible as possible.

This package creates a list of all your routes and assigns these permissions list to user roles.

Although the `laravel-role-permission` package does most of the work, you could easily extend it and implement your authorization system.

### Installation

[](#installation)

Start with installing the package through the composer. Run this command in your terminal:

```
$ composer require abdul/laravel-role-permission

```

After that, you need to run the migration files:

```
$ php artisan migrate

```

### How to authorize user

[](#how-to-authorize-user)

This package adds a `role_id` to the `users` table. Roles are stored in the `roles` table. You can assign the permission to roles in your administrator panel, assign the role to user and Then, you only need to assign `auth.role` middleware to your routes.

### Assign a route to a role

[](#assign-a-route-to-a-role)

Besides middleware and other route settings, you can use a `role` key in your route groups to assign a role to your routes.

You can put your routes for a role in a `Route` group like this:

```
Route::group([
    'middleware' => 'auth.role',
    'prefix' => 'config',
    'module' => 'Role',
    'role' => 'admin',
    ...
],function (){
    Route::get('/roles', 'RoleController@index');
});
```

Of course, you can have as many as route groups like this.

Then you need to run this artisan command to register all permissions:

```
$ php artisan permissions:generate

```

This command will register all permissions and assign permissions to the roles.

If you add a `fresh` option to this command, it will delete all data and generate fresh routes data:

```
$ php artisan permissions:generate --fresh

```

Now only users with the proper role can access the route assigned to them.

Don't forget that this package does not handle assigning roles to the users. You need to handle this in your administration panel or anywhere else you handle your users.

### How to create roles

[](#how-to-create-roles)

The `php artisan permissions:generate` command will make all roles defined in the routes if they are not exist.

Also, You can create a seeder to fill the `roles` table. It takes only a `name` field.

Your `RolesSeeser` file can look like this.

```
Role::firstOrCreate(['name' => 'admin']);
Role::firstOrCreate(['name' => 'customer']);
```

Don't forget to import the `Role` model in your seeder.

```
use Abdul\RolePermission\Models\Role;
```

### How to clear permissions

[](#how-to-clear-permissions)

To clear registered permissions you can run this command:

```
$ php artisan permissions:clear

```

You can use this command to clear all permissions data for a specific role

```
$ php artisan permissions:clear --roles role1 role2

```

To erase only permissions list, run `permissions:clear` command with this option:

```
$ php artisan permissions:clear --tables permissions

```

To clear all roles:

```
$ php artisan permissions:clear --tables roles

```

To clear only permissions role relation:

```
$ php artisan permissions:clear --tables permission_role

```

This command erases all permissions assigned to roles, so you can regenerate permissions

Also, you can use these options in combination:

```
$ php artisan permissions:clear --roles admin --tables permission_role

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2110d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d04cdd750dd5811cf5b882c33d0fe6fc2158752d1102d42b3848af4e7adf2e6?d=identicon)[abdulwahhabkhan](/maintainers/abdulwahhabkhan)

---

Top Contributors

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

---

Tags

laravelrolesuser-groupsdynamic rolesdynamic permissions

### Embed Badge

![Health badge](/badges/abdul-laravel-role-permission/health.svg)

```
[![Health](https://phpackages.com/badges/abdul-laravel-role-permission/health.svg)](https://phpackages.com/packages/abdul-laravel-role-permission)
```

###  Alternatives

[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[codebot/entrust

This package provides a flexible way to add Role-based Permissions to Laravel

1596.6k](/packages/codebot-entrust)

PHPackages © 2026

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