# spatie/laravel-permission

Associate users with roles and permissions

Repository: https://github.com/spatie/laravel-permission
Canonical: https://ross.abutalabs.com/products/laravel-permission
Homepage: https://spatie.be/docs/laravel-permission
Language: PHP
License: MIT
License Family: permissive
Topics: laravel, php, permission, secure
Last push: 2026-08-24T14:14:44+00:00

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 91, longevity 100
- inputs: {"age_days": 4006, "days_push": 9, "days_rel": 61, "gap_med": 7.0, "n_releases_24m": 33}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 12964, forks 1821 (observed 2026-08-28T04:11:00.262135+00:00)

## What it is
A Laravel package that lets you associate users (and other Eloquent models) with roles and permissions stored in the database. Permissions are registered with Laravel's gate so they work with the standard `can` checks and Blade `@can` directives.

## Use cases
- add role-based access control to a Laravel app
- assign permissions to users in a database
- group permissions into roles like writer or admin
- check user permissions with Laravel's can() and Blade @can
- manage permissions across multiple auth guards
- restrict API or page access based on user roles

## When to choose
- you are building a Laravel application and need RBAC
- you want roles and permissions persisted in your database via Eloquent
- you want permissions to integrate with Laravel's native gate and Blade directives
- you need multi-guard support for separate permission sets

## When to avoid
- you are not using Laravel or Eloquent
- you need fine-grained, attribute-based or policy-heavy authorization beyond simple roles/permissions
- you need a standalone authorization service independent of your PHP framework

## Facets
- artifact type: library
- maturity: stable
- function: authorization, auth, middleware
- domain: web-development, backend, security, developer-tools
- platform: php, self-hosted
- tags: laravel, roles-and-permissions, rbac, eloquent, spatie, gate-integration, web-server

## Member repositories
- spatie/laravel-permission (main) score 96

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:00.262135+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:13:39.117232+00:00, confidence not recorded.
  - readme: https://github.com/spatie/laravel-permission (fetched 2026-08-28T04:11:00.262135+00:00, sha 3f7788963006)
  - homepage: https://spatie.be/docs/laravel-permission (fetched 2026-08-29T08:09:45.477957+00:00, sha 755ef9d58265)
  - site_page: https://spatie.be/docs/laravel-permission/v8 (fetched 2026-08-29T08:09:45.491772+00:00, sha 5baa1b2ca242)
  - site_page: https://spatie.be/docs (fetched 2026-08-29T08:09:45.487131+00:00, sha 08e024d86d95)
  - site_page: https://spatie.be/about-us (fetched 2026-08-29T08:09:45.489644+00:00, sha d3cb88e4b34c)
  - site_page: https://spatie.be/docs/laravel-permission/v7 (fetched 2026-08-29T08:09:45.494002+00:00, sha 604168dd1b1b)
  - site_page: https://spatie.be/docs/laravel-permission/v6 (fetched 2026-08-29T08:09:45.496101+00:00, sha dd9982006cb0)
  - site_page: https://spatie.be/docs/laravel-permission/v5 (fetched 2026-08-29T08:09:45.498092+00:00, sha 1cf7100f982b)
  - site_page: https://spatie.be/docs/laravel-permission/v4 (fetched 2026-08-29T08:09:45.499796+00:00, sha c6617c82de12)
  - site_page: https://spatie.be/docs/laravel-permission/v3 (fetched 2026-08-29T08:09:45.501380+00:00, sha af08f058bd86)
- Data as of 2026-08-30T08:39:29.467469+00:00.
