offspring / laravel-permission
Permission handling for Laravel 5.4 to 5.8
Fund package maintenance!
Patreon
Requires
- php: >=7.0
- illuminate/auth: ~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0
- illuminate/container: ~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0
- illuminate/contracts: ~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0
- illuminate/database: ~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0
Requires (Dev)
- orchestra/testbench: ~3.4.2|~3.5.0|~3.6.0|~3.7.0
- phpunit/phpunit: ^5.7|6.2|^7.0
- predis/predis: ^1.1
- dev-master
- 7.3
- 7.2
- 7.1
- 7.0
- 6.8
- 6.7
- 6.6
- 6.5
- 6.4
- 6.3
- 6.2
- 6.1
- 6.0
- 4.6.1
- 4.6
- 4.5
- 4.4
- 4.3
- 4.2
- 4.0.1
- 4.0
- 3.0.0
- v2.x-dev
- 2.38.0
- 2.37.0
- 2.36.1
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.2
- 2.28.1
- 2.28.0
- 2.27.0
- 2.26.2
- 2.26.1
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.1
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.2
- 2.19.1
- 2.19.0
- 2.18.0
- 2.17.1
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.2
- 2.12.1
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.0.2
- 2.0.1
- 2.0.0
- v1.x-dev
- 1.18.0
- 1.17.0
- 1.16.1
- 1.16.0
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.1
- dev-fix-guard-checks
This package is auto-updated.
Last update: 2024-11-21 21:40:07 UTC
README
Sponsor
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 section of the readme.
Because all permissions will be registered on Laravel's gate, you can check if a user has a permission with Laravel's default can
function:
$user->can('edit articles');
Documentation, Installation, and Usage Instructions
See the documentation site for detailed installation and usage instructions.
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
-
Extensive tutorial for building permissions UI by Caleb Oki.
-
Laravel User Management for managing users, roles, permissions, departments and authorization by Mekaeil
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email freek@offspring.be instead of using the issue tracker.
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: Offspring, Samberstraat 69D, 2060 Antwerp, Belgium.
We publish all received postcards on our company website.
Credits
This package is heavily based on Jeffrey Way's awesome Laracasts lessons on permissions and roles. His original code can be found in this repo on GitHub.
Special thanks to Alex Vanderbist who greatly helped with v2
, and to Chris Brown for his longtime support helping us maintain the package.
Alternatives
- Povilas Korop did an excellent job listing the alternatives in an article on Laravel News. In that same article, he compares laravel-permission to Joseph Silber's Bouncer, which in our book is also an excellent package.
- ultraware/roles takes a slightly different approach to its features.
Support us
Offspring is a web design agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
License
The MIT License (MIT). Please see License File for more information.