yajra/laravel-acl
A lightweight Laravel ACL package for role and permission management. Assign roles to users, attach permissions to roles, and check access with simple Eloquent-friendly APIs and Blade helpers.
role/permission middleware plus @role and @permission Blade directives make "who sees this" an explicit, diffable spec item — nav items, destructive buttons, admin panels, export actions — instead of a convention re-invented per squad. That shortens the loop from spec to correctly gated shipped feature and gives QA a concrete checklist rather than tribal knowledge.serializable class handling — the kind of breakage that surfaces late, at queue-drain time, in jobs carrying ACL entities. For a PM this converts an open upgrade risk into a closed one. A stalled framework upgrade freezes every feature queued behind it, so this is roadmap de-risking, not housekeeping.What this package does not decide for you: tenant-scoped roles, immutable compliance-grade authorization logs, attribute/resource-level policy semantics, and federated identity role sync are all out of scope. If any of those sit on the near roadmap, treat this as a v1 accelerator with a planned exit, not a permanent foundation.
Adopt when:
User model and standard auth guards. The v13.1.0 release is direct evidence the package tracks framework majors rather than lagging them.HasRole trait, protect an admin route, gate one nav element — the entire loop (schema → trait → middleware → presentation) is one demoable slice.can() / Policies for ownership checks, using this package only for the coarse gate. Mixed models are fine — silent drift between them is not.Look elsewhere when:
Adoption preconditions worth gating the decision on: a cache-flush-on-deploy convention (permission checks are cache-backed; stale cache is the incident generator), a CI test that proves a bad guard denies rather than silently permits, and idempotent seeders keyed on permission name.
For executives (30-second version). Every product needs roles and permissions; none of ours will be won by how we build them. This package is a small, MIT-licensed Laravel library that lets us configure authorization instead of building it, taking a subsystem off the v1 critical path and giving us a reviewable, seeded permission catalogue instead of production folklore. It is actively maintained against the current Laravel major, which closes an upgrade risk that would otherwise freeze features queued behind it. The trade-off is honest and bounded: it is a focused, low-adoption open-source dependency in a security-adjacent area, it does not do multi-tenancy or audit-grade logs, and the code is small enough that we could own it ourselves if maintenance ever stalled. Recommendation: adopt for v1, with a written re-evaluation trigger tied to multi-tenant scoping, compliance logging, or SSO/SCIM role sync entering the 12-month horizon.
For engineering (what we're actually signing up for). Pin the major (^13.1 on Laravel 13 — do not start on 13.0.0, which predates the serializable fix), publish config and migrations, add the HasRole trait, register the role and permission middleware aliases, and seed a real catalogue idempotently with updateOrCreate keyed on permission name. Standardize on can() and Laravel Policies in application code; keep permission names in constants, not string literals; put a single Gate::before in place for super-admins rather than an isSuperAdmin() preamble in every policy; apply middleware to route groups, not individual routes. Two conventions are non-negotiable before launch: flush the ACL cache on every deploy that touches roles or permissions, and test that a misconfigured guard denies — assert 403/401 in CI, not a redirect that masks the problem. Treat the published config as the extension point; do not fork the trait. The package handles coarse access ("can reach the billing module"); native Policies handle ownership ("can edit this invoice"). That split is the design, not a compromise.
How can I help you explore Laravel packages today?