Skip to content

Migrating from spatie/laravel-permission to Redis: A Production Playbook

6.9 relevance
Score Breakdown
technical depth
8
novelty
6
actionability
9
community
5
strategic
4
personal
6

Scored daily by a customisable AI persona to surface the most relevant engineering leadership news.

Detailed migration playbook from Laravel permissions to Redis, highly actionable for backend engineers but niche to PHP.

General dev.to
Migrating from spatie/laravel-permission to Redis: A Production Playbook
Summary

A production playbook details migrating from spatie/laravel-permission to a Redis-backed alternative, laravel-permissions-redis, for Laravel apps where authorization checks are a measurable share of database load. The migration replaces per-request lazy-loading of role and permission relations (roughly 4 queries) with an O(1) SISMEMBER check against a Redis SET, reducing authorization queries by about 75% and avoiding full cache reloads on permission changes. The post covers pre-migration audits (grepping for specific API calls, handling teams vs. multi-tenancy), a dry-run command, and rollback steps, noting that the 1.3-1.4x wall-clock improvement on SQLite is a wash against networked databases—the real win is offloading the database.

Author

Sebastian Cabarcas

More from Sebastian Cabarcas →