spatie/laravel-permission
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
illuminate/auth | v11.5.0 | - | MIT | prod | |
illuminate/container | v11.5.0 | - | MIT | prod | |
illuminate/contracts | v11.5.0 | - | MIT | prod | |
illuminate/database | v11.5.0 | - | MIT | prod |
Spatie's Laravel-Permission is a composer package that provides an easy way to manage user permissions and roles within a Laravel project. It's specifically designed to work with Laravel version 6.0 and above. The package allows you to assign permissions to a user or via role assignment. All permissions are registered on Laravel's gate so you can use Laravel's default can
function to check a user's permissions.
The Laravel-Permission package can be integrated into your Laravel project by getting it from the Packagist using composer. Once installed, you can add permissions to a user or through a role assignment. Here are some code examples showcasing its usage:
// Adding permissions to a user
$user->givePermissionTo('edit articles');
// Adding permissions via a role
$user->assignRole('writer');
$role->givePermissionTo('edit articles');
Permissions can be checked using Laravel's default can
function like so:
$user->can('edit articles');
You can also keep track of the changes associated with the package from the CHANGELOG.md file included within its GitHub repository.
For detailed documentation, installation steps, and usage instructions of the Laravel-Permission package, you can refer to Spatie's Laravel-Permission Documentation. You can also contribute to the package or report security-related issues following the guidelines provided in the CONTRIBUTING.md and security@spatie.be email respectively. Additional credits and acknowledgements related to the package can be found within the readme file in its GitHub page.