PHPackages                             marksihor/laravel-permissions - 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. marksihor/laravel-permissions

ActiveLibrary

marksihor/laravel-permissions
=============================

Laravel permissions.

06.3k↓100%PHP

Since Mar 23Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-metas
=============

[](#laravel-metas)

Laravel Roles and Permissions package.

Installing
----------

[](#installing)

```
$ composer require marksihor/laravel-permissions -vvv
```

### Migrations

[](#migrations)

This step is optional, if you want to customize the tables, you can publish the migration files:

```
$ php artisan vendor:publish --provider="MarksIhor\\LaravelPermissions\\PermissionsServiceProvider" --tag=migrations
```

### Configs

[](#configs)

To publish configs run the command:

```
$ php artisan vendor:publish --provider="MarksIhor\\LaravelPermissions\\PermissionsServiceProvider" --tag=configs
```

### Controllers

[](#controllers)

This step is optional, if you want to get crud controller (instead of use built in routes) run the command:

```
$ php artisan vendor:publish --provider="MarksIhor\\LaravelPermissions\\PermissionsServiceProvider" --tag=controllers
```

If You published the controller, add the routes to your routes file:

```
Route::group(['as' => 'roles', 'prefix' => 'roles'/*, 'middleware' => 'permission:view roles'*/], function () {
    Route::get('/', 'RoleController@index');
    Route::get('/{model}', 'RoleController@show');
    Route::get('/{model}/permissions', 'RoleController@permissions')/*->middleware('permission:view roles')*/;
    Route::post('/', 'RoleController@store')/*->middleware('permission:create roles')*/;
    Route::patch('/{model}', 'RoleController@update')/*->middleware('permission:update roles')*/;
    Route::delete('/{model}', 'RoleController@delete')/*->middleware('permission:delete roles')*/;
    Route::patch('/{model}/permissions/{action}', 'RoleController@updatePermissions')
        ->where('action', '(attach|detach|update)')
        /*->middleware('permission:update roles')*/;
});
```

Usage
-----

[](#usage)

1 . Run migrations

```
php artisan migrate
```

2. Add next line to $routeMiddleware array of your Kernel.php file

```
    'permission' => \MarksIhor\LaravelPermissions\Http\Middleware\PermissionMiddleware::class,
```

3. Add role relationship to your user model

```
public function role()
{
    return $this->belongsTo('MarksIhor\LaravelPermissions\Models\Role');
}
```

4. Use it on route like this

```
Route::get('/', 'UserController@index')->middleware('permission:view users');
```

5. Or in other places like this

```
app('auth')->user()->role->hasPermission($permissionName); // bool
```

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 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/502c6ff875a2fb864db565af2932a45065d754883b6bc3e6819adcc7a326cb22?d=identicon)[marksihor](/maintainers/marksihor)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/marksihor-laravel-permissions/health.svg)

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

PHPackages © 2026

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