Outsource Laravel Development Partner - $3200/Month | Bacancy

Laravel Permission

spatie/laravel-permission image

Laravel Permission stats

Downloads
35.2M
Stars
11,481
Open Issues
3
Forks
1,727

View on GitHub →

Permission handling for Laravel 8.0 and up

Laravel Permission Package by Spatie

The Laravel Permission package by Spatie is a powerful tool for handling authorization in Laravel applications, allowing you to manage user permissions and roles through a database effectively.

Key Features

  • Ease of Role and Permission Management: Quickly assign permissions directly to users or via roles.
  • Integration with Laravel's Gate: All permissions are registered on Laravel's gate, enabling you to check user permissions using Laravel's native can method.
  • Extensive Documentation: Offers comprehensive documentation that guides through installation and usage.
  • Active Maintenance and Community Contribution: Encourages contributions and provides a clear guideline on how to contribute.

Installation and Usage

Install the package via composer:

composer require spatie/laravel-permission

Here's a quick example to get you started:

// Assigning permissions to a user
$user->givePermissionTo('edit articles');
 
// Assigning a role to a user
$user->assignRole('writer');
 
// Checking if a user has a permission
$user->can('edit articles');

For detailed installation and usage instructions, check the official documentation.

Support and Contributions

  • Community and Support: Spatie encourages sending postcards if their package has helped you, showcasing them on their virtual wall.
  • Contributing: Contribution guidelines are provided to help maintain the quality of the package.
  • Security Issues: Direct communication via email is advised for any security-related concerns.

Additional Information

  • Changelog and Updates: The CHANGELOG is actively maintained, detailing all significant changes.
  • License: Distributed under the MIT License, allowing flexibility for personal and commercial use.

This package is inspired by Jeffrey Way’s Laracasts lessons and is recognized for its robustness and ease of use in the Laravel community. Whether you're building a small project or a large-scale application, the Laravel Permission package offers a reliable solution for managing user roles and permissions efficiently.

spatie photo

We create open source, digital products and courses for the developer community

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Spatie Laravel Permission Related Articles

Packistry is a Self-hosted Composer Repository Made with Laravel image

Packistry is a Self-hosted Composer Repository Made with Laravel

Read article
Laravel Jetstream: Add CRUD with Spatie Permission image

Laravel Jetstream: Add CRUD with Spatie Permission

Read article
Laravel Query Builder image

Laravel Query Builder

Read article
Two Best Laravel Packages to Manage Roles/Permissions image

Two Best Laravel Packages to Manage Roles/Permissions

Read article
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review