mike-bronner/laravel-governor
Laravel Governor is a role and permission management package for Laravel that helps you define roles and abilities, assign them to users, and authorize access throughout your application with a simple, flexible API. It’s a lightweight way to add role-based access control to Laravel projects.
composer require genealabs/laravel-governor — pin ^0.22 if you're on Laravel 13 (see Gotchas), otherwise ^0.21 is fine on older frameworks.php artisan governor:setup): it publishes config/governor.php, the migrations, and seeds the default roles (SuperAdmin/Admin/Member) plus permission records for the models it discovers.HasRoles trait to your App\Models\User (and any other authenticatable model that needs its own role set).config/governor.php (super-admin role name, entity discovery, UI route), the governor_roles / governor_permissions / pivot tables, and the bundled Governor admin screen.is_admin columns. Create a Post, hit $user->can('update', $post) in a controller — Governor's generated policies answer through role→entity permissions, and you flip the answer in the UI instead of in code.@can, $this->authorize(), Gate::allows() and Blade directives all work unchanged. Treat the package as a permissions store, not an authorization API to call from your controllers.author_id, polymorphic owners) before trusting it.roles relation in seeders/console commands. For provisioning (tenant onboarding, first admin), write an idempotent seeder that creates roles and attaches them rather than clicking through the UI per environment.php artisan migrate in CI does not create them by itself. Consider a deploy step or a data migration that creates permissions for entities added in a release.actingAs($this->admin) vs actingAs($this->member) against the same feature test. Seed the roles you need in TestCase::setUp — don't rely on the package's seeded defaults surviving a RefreshDatabase.laravel/framework and the failure looks like a framework problem, not a package constraint. Conversely, 0.22.0 has no reason to break L10/L11 consumers, but it's a 0.x package: pin the minor and read each changelog. Minor bumps here have historically carried behaviour changes.governor_permissions table before debugging your policy.php artisan cache:clear, or the package's own cache key) before concluding it "didn't work."config/governor.php, or disable it in production entirely and manage roles via console/seeders.roles-style relations and Gate hooks; conflicts show up as confusing "permission granted by one, denied by the other" behaviour.php artisan route:list | grep -i governor → inspect the governor_* tables directly → Gate::forUser($u)->inspect('update', $post) to see which policy/ability actually answered. inspect() tells you far more than the boolean can().How can I help you explore Laravel packages today?