Gate/Policy system but with additional tooling (e.g., automatic ability generation, field-level policies).Gate registration, no first-party support for Laravel’s newer authorization features like can() with model binding).Gate registration, custom middleware for route authorization).Gate, Policy) has evolved significantly since 5.x. This package duplicates functionality that is now native (e.g., authorize() in controllers, can() helpers).Why not use Laravel’s native Gate/Policy?
What’s the migration path?
Maintenance & Support
Security Implications
Team Buy-In
Gate registration changes, middleware adjustments).Gate system (no first-party support for newer authorization helpers).config/auzo-tools.php auto-discovery in modern versions).| Step | Action | Risk | Mitigation |
|---|---|---|---|
| 1 | Assess Laravel Version | High | If on Laravel 5.x, proceed. If not, evaluate alternatives (e.g., spatie/laravel-permission). |
| 2 | Install & Publish Config | Low | Run composer require kordy/auzo-tools and publish config/translations. |
| 3 | Define Policies | Medium | Choose between callbacks (quick but less maintainable) or class methods (better for complex logic). |
| 4 | Register Policies in AppServiceProvider |
Low | Call \AuzoToolsPermissionRegistrar::registerPermissions() with config('acl'). |
| 5 | Integrate Middleware | Medium | Replace auth middleware with auzo.acl for route-level checks. |
| 6 | Adapt Validation Rules | Low | Use auzo.can in form requests. |
| 7 | Enable Field-Level Policies | High | Requires adding ModelFieldsPolicy trait to models; test thoroughly for API responses. |
| 8 | Generate Abilities Automatically | Medium | Use GenerateAbilities for CRUD/field-level abilities, but cache results to avoid runtime generation. |
Gate registration, middleware, and service provider booting).authorize() method in controllers.can() with model binding.Gate policies with auzo-tools equivalents.composer update won’t break the package (e.g., Laravel core changes).GenerateAbilities) could slow down boot time if not cached.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Policy Logic Error | Incorrect access granted/denied | Unit test all policies; use after callbacks for logging. |
| Middleware Misconfiguration | Routes bypass authorization | Validate middleware registration in CI/CD. |
| Field-Level Policy Bug | API returns sensitive data | Test with tinker before production; use hidden()/visible() as fallback. |
| Laravel Update Breaks Package | Package stops working | Pin Laravel version in composer.json; fork if needed. |
| PHP 8.x Deprecation | Runtime errors | Backport fixes or migrate to a modern alternative. |
How can I help you explore Laravel packages today?