Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

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

Spatie Shares Their Coding Guidelines as AI Skills image

Spatie Shares Their Coding Guidelines as AI Skills

Read article
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
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
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
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
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
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
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten