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

Tighten

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

Tighten
Lucky Media logo

Lucky Media

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

Lucky Media
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech
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
Honeybadger logo

Honeybadger

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

Honeybadger
Statamic logo

Statamic

The drop-in ready Laravel CMS you’re been waiting for. Go full-stack or headless, flat file or database – it’s up to you.

Statamic