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

SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
Honeybadger logo

Honeybadger

Simple developer-focused application monitoring for Laravel. Error tracking, log management, uptime monitoring, status pages, and more!

Honeybadger
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises