livelyworks/laravel-yes-authority
LivelyWorks Yes Authority is a Laravel package for role- and permission-based access control. It helps define roles, assign permissions, and protect routes and views with simple authorization checks.
Architecture fit. YesAuthority is a thin, opinionated authorization layer keyed on route names rather than model instances or abilities. That places it adjacent to, not on top of, Laravel's native Gate/Policy system: Gates answer "can this user perform this ability on this resource," while YesAuthority answers "can this user reach this named route." For applications with large, flat route surfaces — admin panels, ERP-style back offices, nav-menu-driven apps where the route is the permission boundary — that is a genuinely useful abstraction and avoids the boilerplate of a policy per screen. It is a poor fit for APIs with fine-grained, resource-scoped authorization, for multi-tenant row-level rules, or for anything where permissions must be data-driven at runtime. The design is intentionally small: a service provider, a middleware alias, a config-declared route-access map, a helper/Blade directive, and wildcard matching over route names. That small surface is the main architectural asset and the main operational liability.
Integration feasibility. Mechanically straightforward. composer require, publish the config, register the middleware alias (auto-discovery expected on modern Laravel — verify), populate a route => [roles] map, attach authority to route groups. There is no schema, no migration, no event surface, no external service. A competent Laravel engineer can have a pilot group running in under a day. The integration effort is not in the package — it is in inventorying your named routes and building an accurate access map, which is a one-to-many mapping exercise and a recurring governance cost, not a one-time task.
Technical risk. High, and concentrated in three areas.
bootstrap/app.php config) is unverified and must be proven, not assumed. PHP 8.3/8.4 deprecation noise is plausible on a package this quiet.Key questions. (1) Does it install and pass a smoke test on our target Laravel version, and what are its illuminate/* and PHP constraints? (2) On an unmatched route name, does it deny by default — and is that behavior tested or incidental? (3) How is the authenticated user resolved across multiple guards (web/session vs. Sanctum/API tokens)? (4) What is wildcard precedence when multiple patterns match, and is it deterministic and documented? (5) How is the compiled route map cached, and what invalidates it on deploy? (6) Is there a test suite we can run, and what is its coverage of the deny paths? (7) Can we fork it cleanly under our own namespace and publish to a private registry?
Stack fit. Best suited to server-rendered Laravel monoliths with session-auth and a large named-route surface. It is a natural companion to an existing Gate/Policy setup rather than a replacement: leave resource-level authorization in policies, use YesAuthority for the coarse "may this user enter this screen" gate at the route layer. Stateless API/token stacks are a weaker fit — confirm guard handling before scoping it to any JSON surface.
Migration path. Do not rip out existing authorization. Run in parallel and diff.
Compatibility. Pin an exact version in composer.json (no caret range on a package this inactive). Verify against the lowest Laravel and PHP version we support, not the newest, since forward compatibility is the open question. Add a CI job that runs the package's own tests plus a small authorization matrix of our own (allow, deny, unmatched route, wildcard overlap, multi-guard) so any future Laravel bump fails loudly.
Sequencing. (1) Timeboxed spike: install, one route group, verify Laravel/PHP matrix and unmatched-route behavior. Gate: fail-closed confirmed. (2) Route-name inventory and initial access map, reviewed by whoever owns the permission model. (3) Pilot group with shadow-mode logging. (4) Decision point — adopt upstream, fork, or build ~150 lines of equivalent middleware in-house. (5) If adopted: fork to an internal namespace, add tests for deny paths, document wildcard precedence. (6) Expand coverage incrementally; add a CI check that every route name in the router appears in the access map.
The fork-or-build decision is the real fork in this road. The package's logic is small enough that reimplementing it around native Gates is a credible, low-cost alternative to inheriting an unmaintained dependency in a security-critical position.
Maintenance. Treat upstream as frozen. Last release 2023, seven stars, no dependents — assume no one else is filing or fixing issues. Budget for an internal fork with a named code owner, and roughly a day or two per quarter to re-verify against Laravel/PHP upgrades. The alternative — absorbing a break inside an auth middleware during a framework upgrade under time pressure — is materially worse.
Support. There is no vendor, no SLA, no security advisory channel. Issue triage is whatever the maintainer's attention permits. This is acceptable for a convenience library and not acceptable for an authorization library unless we own the code. Forking converts an unbounded support risk into a bounded, staffed one.
Scaling. Runtime cost is per-request route-to-rule matching. Uncached, it is roughly linear in rules × routes and will show up on high-QPS paths; the config-driven design implies a compiled map that should be cached and warmed at deploy. More important is organizational scaling: every new screen requires a route-name entry and a review. That is a process that works at 50 routes and strains at 500 without tooling. Plan for a CI assertion that the access map and the router agree, or the map will drift.
Failure modes. Ranked by blast radius:
admin.*) grants more than intended as routes are added beneath it. Mitigate with explicit precedence documentation and a lint rule.Ramp-up. Technical ramp is low: a Laravel developer reads the config and middleware in half a day. The real ramp is procedural — the team must internalize that route names are now permission identifiers and treat renaming one as a permission-model change requiring review. That norm, plus the CI check enforcing it, is the difference between this being a clean abstraction and a periodic incident. Allocate the first sprint to the spike and the route inventory; do not let the ease of composer require disguise the governance work that follows it.
How can I help you explore Laravel packages today?