n3xt0r/laravel-passport-modern-scopes
Attribute-based OAuth scope enforcement for Laravel Passport. Declare required scopes directly on controllers/actions via PHP 8 attributes, then enforce them with a single middleware. Keeps routes clean and auth rules close to the code they protect.
user:read:own, user:read:all, user:write:admin), replacing coarse-grained scopes like user:read or user:write. This aligns with modern API security needs (e.g., zero-trust, least-privilege access).patient:read:own for healthcare APIs). Reduces audit risk by logging granular scope violations.tenant:{id}:read for isolated data access.partner:read:orders).admin:user:delete).user:*) to a zero-trust model.user:read:all without permission").read/write without attribute constraints).For Executives:
"This package modernizes our API security by replacing broad OAuth scopes (e.g., user:read) with granular, attribute-based controls (e.g., user:read:own). It reduces risk of data leaks, simplifies compliance audits, and cuts dev time by avoiding custom scope logic. For example, a support agent could only access ticket:read:own, while admins get ticket:read:all. MIT license means no vendor lock-in."
For Engineering:
*"Leverage n3xt0r/laravel-passport-modern-scopes to:
Passport::scope() with attribute-based checks (e.g., if (!$user->hasScope('user:read:own')) abort(403)).config/passport.php.How can I help you explore Laravel packages today?