directorytree/authorization
An easy, native role and permission management system for Laravel. Assign roles and permissions to your models, check abilities, cache lookups, and protect routes with built-in middleware.
composer require plus php artisan migrate. The PM decision is whether role/permission infrastructure belongs on your roadmap at all; this package lets you strike it off and redirect that engineering capacity to differentiating features. For most apps, a hand-rolled RBAC layer is two to four weeks of work that is invisible to customers when it ships and embarrassing when it's wrong.grant, revoke, grantOnly, revokeAll). Everything above the data model — the settings screen, the permission matrix UX, the invite flow — is your product surface, and this package removes the backend prerequisite for it.grantOnly() makes a role's permission set idempotent, which means your role catalog can live in seeders/config and be reconciled on deploy. That's a roadmap enabler for "standard roles ship with the product, custom roles are tenant-defined."@can, $this->authorize(), Gate::allows() and the two supplied middleware (permission:, role:) all work with no extra wiring. This directly reduces the cost of adding route-level and view-level guards later, without a second authorization idiom appearing in the codebase.users.create, reports.export), so the same mechanism can back plan-based feature flags, gradual rollout of a new module to a subset of accounts, or internal-only tooling — without standing up a separate flag system.Adopt when:
Look elsewhere when:
spatie/laravel-permission (teams) first.users.*, or "edit implies view"). Name matching is exact.Two implementation details that become PM-visible risks:
PermissionRegistrar in setUp(). If you gate PRs on test coverage, expect a small, recurring developer-experience tax until it's in the base TestCase.For executives: This is a free, MIT-licensed component that replaces a build we would otherwise schedule. It gives us the standard role-and-permission backend — roles, permissions, per-user overrides, caching, route guards — so the team can spend its time on the admin experience customers actually see, and on the features that differentiate us. It integrates with the framework's own authorization mechanism rather than introducing a parallel one, so it doesn't create a maintenance liability or a migration project if we ever outgrow it. The honest caveats: it does not include an audit log or multi-tenant role scoping, both of which have known solutions we'd add if enterprise requirements demand them.
For engineering: A thin, trait-based layer over Eloquent and the Gate. Install, migrate, add the Authorizable trait to User. Permissions auto-register as Gate abilities, so can(), authorize(), @can, and the bundled role:/permission: middleware all work immediately. Models and migrations are fully overridable; every behavior can be extended because the implementation is traits, not a service with a fixed API. The assignment API is grant/revoke/grantOnly/revokeAll on both roles and users, accepting names, models, arrays, or collections. Permission caching is on by default with configurable key and expiry, flushed on write — verify invalidation covers your seeding path. Tests need app(PermissionRegistrar::class)->register() in setUp(). Dependency is supported through Laravel 13 and actively version-tracked; keep the surface small and we retain an exit path at all times.
How can I help you explore Laravel packages today?