Download the PHP package laravarc/authorizer without Composer
On this page you can find all versions of the php package laravarc/authorizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravarc/authorizer
More information about laravarc/authorizer
Files in laravarc/authorizer
Package authorizer
Short Description RBAC engine for Laravel — Gate::before abilities, roles, and tenant-scoped authorization. Usable with or without laravarc/core.
License MIT
Homepage https://github.com/laravarc/authorizer
Informations about the package authorizer
Laravarc Authorizer
RBAC for Laravel — roles, abilities, and Gate::before() checks.
Works in any Laravel 10–13 application, with or without laravarc/core.
Design
- Policy = business rule — policy classes stay plain; they never call Authorizer.
- Authorizer = RBAC — ability checks run in
Gate::before()before policy methods. - Source of truth is code — abilities are discovered from policy classes (or Core metadata), never created ad-hoc via a public
Ability::create()API. - Tenant-ready —
tenant_idon roles is a plain nullable id (no foreign key). SwapTenantResolverfor multi-tenant apps.
Installation
Add the trait to your user model:
Route middleware
| Alias | Purpose |
|---|---|
laravarc.authorize.super |
Require an authenticated user with an Authorizer super role (isSuper()) |
When using laravarc/core, ability-based route checks use Core's laravarc.authorize middleware (same laravarc.authorize* family).
How authorization works
Fluent API
Grant expansion
grant(Policy::class) stores expanded rows in larc_role_abilities (one per ability), not a live policy.* rule.
When laravarc:authorizer sync later discovers a new method on that policy, existing roles that previously granted the policy do not automatically receive the new ability. Re-grant the policy (or grant the new method) after sync.
Commands
| Command | Alias | Purpose |
|---|---|---|
laravarc:authorizer cache |
larc:authorizer cache |
Build ability index (PSR-4 policy scan) |
laravarc:authorizer cache --clear |
same | Clear cached index |
laravarc:authorizer sync |
larc:authorizer sync |
Sync abilities to the database |
laravarc:authorizer sync --dry-run |
same | Preview only |
laravarc:authorizer sync --auto-delete-missing |
same | Delete missing abilities without prompts |
laravarc:authorizer install |
larc:authorizer install |
Seed the system super role (is_super + is_system) |
Multi-tenant
null from current() means global (single-tenant) roles and leaves hasAbility() on the union-all path. When current() returns a non-null id, hasAbility() only counts role grants for roles with that tenant_id (is_super still bypasses; NULL-tenant non-super roles do not match). Role name uniqueness is enforced in the service layer (SQL UNIQUE alone is unsafe with NULL tenant_id).
Core integration (optional)
Core rebinds AbilityRegistry to MetadataAbilityRegistry. Authorizer never imports Core.
License
MIT — see LICENSE.
All versions of authorizer with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/auth Version ^10.0|^11.0|^12.0|^13.0
illuminate/filesystem Version ^10.0|^11.0|^12.0|^13.0