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

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

287640817/laravel-permission
============================

Permission handling for Laravel 5.4 and up on

015PHP

Since Aug 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/287640817/laravel-permission)[ Packagist](https://packagist.org/packages/287640817/laravel-permission)[ RSS](/packages/287640817-laravel-permission/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Associate users with permissions and roles
==========================================

[](#associate-users-with-permissions-and-roles)

### Sponsor

[](#sponsor)

  [![](https://camo.githubusercontent.com/eb9a452c66b9f767b621229877ddf3f7054a5157b6144a4a59f31ac82141eee7/687474703a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7065726d697373696f6e2f73706f6e736f722d6c6f676f2e706e67)](https://camo.githubusercontent.com/eb9a452c66b9f767b621229877ddf3f7054a5157b6144a4a59f31ac82141eee7/687474703a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7065726d697373696f6e2f73706f6e736f722d6c6f676f2e706e67) If you want to quickly add authentication and authorization to Laravel projects, feel free to check Auth0's Laravel SDK and free plan at [https://auth0.com/overview](https://auth0.com/overview?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=laravel-permission&utm_content=auth). [![Latest Version on Packagist](https://camo.githubusercontent.com/8dac7f853825c1340b3a9d9a7905a75e01876fb19df42e145bf076a27d61f444/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d7065726d697373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-permission)[![Build Status](https://camo.githubusercontent.com/6e5e5edc60dd0091987a71b67959130e969d9d6dfb3ed7c3d4ad220c9239e91e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c61726176656c2d7065726d697373696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/laravel-permission)[![StyleCI](https://camo.githubusercontent.com/cc51255e9a836dd8165e58f1946d0f5b0db78f3f7a5a0f3e22ae65e170109892/68747470733a2f2f7374796c6563692e696f2f7265706f732f34323438303237352f736869656c64)](https://styleci.io/repos/42480275)[![Total Downloads](https://camo.githubusercontent.com/ad5f5474cf3f24431e97d50a8db551720b656aaf774137db2ebcb4ac074fa16e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d7065726d697373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-permission)

This package allows you to manage user permissions and roles in a database.

Once installed you can do stuff like this:

```
// Adding permissions to a user
$user->givePermissionTo('edit articles');

// Adding permissions via a role
$user->assignRole('writer');

$role->givePermissionTo('edit articles');
```

If you're using multiple guards we've got you covered as well. Every guard will have its own set of permissions and roles that can be assigned to the guard's users. Read about it in the [using multiple guards](#using-multiple-guards) section of the readme.

Because all permissions will be registered on [Laravel's gate](https://laravel.com/docs/5.5/authorization), you can check if a user has a permission with Laravel's default `can` function:

```
$user->can('edit articles');
```

Documentation
-------------

[](#documentation)

You can find installation instructions and detailed instructions on how to use this package at [the dedicated documentation site](https://docs.spatie.be/laravel-permission/v2/introduction/).

Need a UI?
----------

[](#need-a-ui)

The package doesn't come with any screens out of the box, you should build that yourself. Here are some options to get you started:

- [Laravel Nova package by @vyuldashev for managing Roles and Permissions](https://github.com/vyuldashev/nova-permission)
- [Laravel Nova package by @paras-malhotra for managing Roles and Permissions and permissions based authorization for Nova Resources](https://github.com/insenseanalytics/laravel-nova-permission)
- [Extensive tutorial for building permissions UI](https://scotch.io/tutorials/user-authorization-in-laravel-54-with-spatie-laravel-permission) by [Caleb Oki](http://www.caleboki.com/).
- [How to create a UI for managing the permissions and roles](http://www.qcode.in/easy-roles-and-permissions-in-laravel-5-4/)

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

This package is heavily based on [Jeffrey Way](https://twitter.com/jeffrey_way)'s awesome [Laracasts](https://laracasts.com) lessons on [permissions and roles](https://laracasts.com/series/whats-new-in-laravel-5-1/episodes/16). His original code can be found [in this repo on GitHub](https://github.com/laracasts/laravel-5-roles-and-permissions-demo).

Special thanks to [Alex Vanderbist](https://github.com/AlexVanderbist) who greatly helped with `v2`, and to [Chris Brown](https://github.com/drbyte) for his longtime support helping us maintain the package.

Alternatives
------------

[](#alternatives)

- [Povilas Korop](https://twitter.com/@povilaskorop) did an excellent job listing the alternatives [in an article on Laravel News](https://laravel-news.com/two-best-roles-permissions-packages). In that same article, he compares laravel-permission to [Joseph Silber](https://github.com/JosephSilber)'s Bouncer, which in our book is also an excellent package.
- [ultraware/roles](https://github.com/ultraware/roles) takes a slightly different approach to its features.

Support us
----------

[](#support-us)

Spatie is a web design agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/spatie). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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://avatars.githubusercontent.com/u/15372834?v=4)[中转站](/maintainers/287640817)[@287640817](https://github.com/287640817)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (249 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (239 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (40 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (14 commits)")[![tomlankhorst](https://avatars.githubusercontent.com/u/675432?v=4)](https://github.com/tomlankhorst "tomlankhorst (11 commits)")[![287640817](https://avatars.githubusercontent.com/u/15372834?v=4)](https://github.com/287640817 "287640817 (11 commits)")[![springleng](https://avatars.githubusercontent.com/u/1900972?v=4)](https://github.com/springleng "springleng (6 commits)")[![artissant](https://avatars.githubusercontent.com/u/2280426?v=4)](https://github.com/artissant "artissant (5 commits)")[![barryatswisnl](https://avatars.githubusercontent.com/u/18284224?v=4)](https://github.com/barryatswisnl "barryatswisnl (4 commits)")[![lowerends](https://avatars.githubusercontent.com/u/6588791?v=4)](https://github.com/lowerends "lowerends (4 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (3 commits)")[![cesargb](https://avatars.githubusercontent.com/u/25681494?v=4)](https://github.com/cesargb "cesargb (3 commits)")[![ctf0](https://avatars.githubusercontent.com/u/7388088?v=4)](https://github.com/ctf0 "ctf0 (3 commits)")[![fullstackfool](https://avatars.githubusercontent.com/u/14146557?v=4)](https://github.com/fullstackfool "fullstackfool (3 commits)")[![mattdfloyd](https://avatars.githubusercontent.com/u/185187?v=4)](https://github.com/mattdfloyd "mattdfloyd (3 commits)")[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (3 commits)")[![JasperBeaurain](https://avatars.githubusercontent.com/u/1786080?v=4)](https://github.com/JasperBeaurain "JasperBeaurain (2 commits)")[![markvesterskov](https://avatars.githubusercontent.com/u/7515900?v=4)](https://github.com/markvesterskov "markvesterskov (2 commits)")[![vkarampinis](https://avatars.githubusercontent.com/u/330736?v=4)](https://github.com/vkarampinis "vkarampinis (2 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (2 commits)")

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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