spatie/laravel-authorize
Route middleware for Laravel authorization. Protect routes and groups using Laravel’s Gate abilities via the can: middleware syntax, with support for route model binding (e.g., can:editPost,post) to authorize access to specific models.
/admin/users or /admin/settings with granular permissions (e.g., can:manageUsers).can:viewTenant:{tenantId}).can:accessFeature:beta).Adopt when:
Look elsewhere when:
spatie/laravel-permission.For Executives:
"This package lets us lock down sensitive routes (e.g., admin panels, user data) with a single line of code—no custom engineering. For example, protecting /admin/billing with can:manageBilling takes 5 minutes instead of a dev week. It’s MIT-licensed, battle-tested by 200+ apps, and integrates seamlessly with Laravel’s built-in auth. The tradeoff? We sacrifice some flexibility for speed, but that’s fine for our current roadmap. Let’s use it to ship faster while keeping our data secure."
For Engineering:
*"This is a lightweight middleware to enforce route-level permissions using Laravel’s native Gate system. Key benefits:
AuthServiceProvider (e.g., Gate::define('viewTopSecretPage', fn($user) => $user->isAdmin())) and apply them via route middleware.if ($user->isAdmin()) checks scattered across controllers.For Design/Compliance: *"This package helps us enforce least-privilege access without reinventing the wheel. For example:
can:manageUsers see /admin/users.can:viewTenant:{id}.
It’s a drop-in solution that aligns with our security audits while keeping development efficient."*How can I help you explore Laravel packages today?