scabarcas/laravel-permissions-redis
A Laravel package that adds a Redis-backed permissions layer for fast authorization. Store and check roles and permissions with less database overhead, ideal for high-throughput apps needing quick access checks and simple integration with Laravel’s authorization ecosystem.
Architecture fit
The package targets a real, narrow inefficiency: Laravel's authorization path (Gate, policies, @can, middleware) resolves role/permission state per request, and most teams back that with Eloquent queries or a cache layer they hand-rolled. A Redis-native implementation is architecturally coherent with the typical Laravel production topology, where Redis is already present for sessions, queues, and cache. Fit is therefore high for greenfield services already treating Redis as tier-0 infrastructure, and moderate-to-low for shops where Redis is optional or single-node convenience infrastructure — this package promotes Redis from "nice to have" to a hard authorization dependency.
The critical architectural unknown is the data topology. Two very different products could live behind this description:
| Model | Implication |
|---|---|
| Redis as read-through cache in front of relational tables | Low risk; a Redis outage degrades latency, not correctness |
| Redis as source of truth | High risk; durability, eviction, and backup become authorization concerns |
Until that is confirmed from source, assume the riskier reading and plan accordingly.
Integration feasibility
Effort is bimodal. A greenfield service can adopt in an afternoon: publish config, add a trait or resolver, wire a service provider, seed role data. Retrofitting an existing application is materially harder because authorization is a cross-cutting concern with many call sites — policies, Gate::before super-admin bypasses, Blade directives, form requests, API middleware, and any queued job that re-checks permissions. Every one of those must resolve through a single path or you get split-brain authorization, which is a security defect class rather than a bug.
The realistic integration cost is not the package; it is building a thin internal AuthorizationService façade so the vendor is swappable, plus a dual-write and shadow-read harness to prove parity before cutover.
Technical risk
Adoption signal is the dominant risk: 39 stars and zero dependents means effectively no production validation in the wild, no Stack Overflow corpus, and no community-derived edge-case hardening. This sits in direct competition with spatie/laravel-permission (~13k stars), which already ships a cache layer; the package's differentiation must be Redis-first storage or a meaningfully better read path, not merely "faster than Eloquent."
Additional risks:
predis vs phpredis. Laravel's Redis layer changed behavior across recent majors (serialization, PhpRedisConnector options, cluster support).Gate bootstrapping can silently shadow each other.Key questions for the maintainer (or for source review)
maxmemory-policy? (allkeys-lru would silently evict authorization data — an unacceptable default if Redis is the source of truth.)Stack fit
Laravel 9–12, PHP 8.1+, Redis 6/7 via phpredis (preferred) or predis, coexisting with Horizon and standard queue/session/cache usage. Best fit: read-heavy APIs or BFFs with high authorization QPS and modest write rates to roles — the exact profile where per-request DB authorization shows up in p99. Poor fit: low-traffic internal apps (no benefit, added dependency), or regulated environments requiring auditable relational authorization state.
Migration path
Do not rip and replace. Use a parallel-run migration:
Compatibility
If an existing spatie/laravel-permission install is present, plan for replacement, not composition. Verify trait method collisions, config key overlaps, and Gate::before ordering in a scratch branch before committing to either path. Also validate the package against the exact Laravel minor in use — a small package is unlikely to have tested your combination.
Sequencing and effort shape
| Phase | Work | TPM read |
|---|---|---|
| Spike | Source review + benchmark | 2–5 days; the go/no-go gate |
| Façade | Internal authz interface | 1–2 weeks, reusable regardless of vendor |
| Dual-write + shadow | Parity harness, dashboards | 1–2 weeks |
| Canary | Flag rollout, revocation drill | 1–2 weeks |
| Steady state | Runbook, alerting | Ongoing |
Roughly 4–6 engineer-weeks for a team with an existing authorization layer; substantially less for greenfield.
Maintenance
Bus factor 1 with no commercial backing. The defensible posture is: pin an exact version, disable unattended dependency updates for this package, vendor or fork it into your monorepo if it becomes load-bearing, and assign a named internal owner. Budget for the possibility that you maintain the fork yourself within 12 months — that is the realistic cost of adopting a 39-star package into an authorization path.
Support
No SLA, no vendor escalation, no paid tier. Issue response is best-effort. Any incident involving this package is resolved by your team reading source. That is acceptable for a cache-shaped concern; it is a poor fit for a security-critical control plane unless you have forked it.
Scaling
The upside is real: authorization becomes an O(1) Redis round trip, removing a join-heavy query from every request. The costs:
Failure modes
| Failure | Consequence | Mitigation |
|---|---|---|
| Redis unavailable | All authorization decisions fail | Explicit fail-open/fail-closed policy; fail-closed on writes, never fail-open on privileged routes |
maxmemory eviction |
Silent permission loss — users gain or lose access unpredictably | noeviction or a dedicated instance; monitor evicted keys |
| Stale read after revocation | Revoked user retains access until TTL/refresh | Bounded revocation SLO; publish invalidation on role change; test the drill |
| Cluster failover / split-brain | Divergent permission state across nodes | Require replicated topology with documented consistency behavior |
| Flush or restart | Empty permission set → mass denial or mass grant | Warm-up on boot; treat empty state as an error, not as "no permissions" |
| Dual-write drift during migration | Two systems disagree; intermittent, hard-to-reproduce bugs | Shadow-read divergence alerting before cutover |
The two failure modes that should gate adoption are revocation staleness (a security incident, not an outage) and fail-open under Redis loss (privilege escalation). Both must have written, tested answers before this touches production.
Ramp-up
Low for a Laravel developer — the mental model is familiar and the surface is small. Medium-to-high for on-call, because authorization failures present as scattered 403s, mysterious UI differences, and "works for me" reports rather than as a clean alarm. Required before launch:
Overall TPM verdict: conditional adopt, not a default recommendation. The opportunity score (12.79) reflects a crowded space where the incumbent already offers caching and 300× the adoption. This package is defensible for a read-heavy service where authorization latency is a measured, named problem — and where the team is willing to own the fork and write down the failure policy. For a team evaluating it as a drop-in Spatie replacement, the answer is no: zero dependents and an unverified release feed are disqualifying for a security-critical path without a source review and a parallel-run migration.
How can I help you explore Laravel packages today?