laravel-permission

Associate users with roles and permissions

Github stars Tracking Chart

Associate users with permissions and roles

Latest Version on Packagist

StyleCI
Total Downloads

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');

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');

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Documentation, Installation, and Usage Instructions

See the DOCUMENTATION for detailed installation and usage instructions.

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@spatie.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: Spatie, 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

License

The MIT License (MIT). Please see License File for more information.

Main metrics

Overview
Name With Ownerspatie/laravel-permission
Primary LanguagePHP
Program languagePHP (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2015-09-14 22:19:38
Pushed At2025-04-09 22:10:36
Last Commit At
Release Count200
Last Release Name6.17.0 (Posted on )
First Release Name0.0.1 (Posted on )
用户参与
Stargazers Count12.4k
Watchers Count191
Fork Count1.8k
Commits Count1.8k
Has Issues Enabled
Issues Count1433
Issue Open Count7
Pull Requests Count521
Pull Requests Open Count5
Pull Requests Close Count282
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private