saeedaz19 / authorizo
A lightweight role and permission management package for Laravel, with a ready-to-use admin UI for creating roles and assigning them to users.
Fund package maintenance!
Requires
- php: ^8.3
- illuminate/support: ^12.0||^13.0
Requires (Dev)
- larastan/larastan: ^3.9
- laravel/agent-detector: ^2.0
- laravel/chisel: ^0.1
- laravel/pao: ^1.0
- laravel/pint: ^1.29
- laravel/prompts: ^0.3
- orchestra/testbench: ^10.0||^11.0
- pestphp/pest: ^4.6||^5.0
- pestphp/pest-plugin-laravel: ^4.1||^5.0
- pestphp/pest-plugin-type-coverage: ^4.0||^5.0
- phpstan/extension-installer: ^1.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-03 11:56:07 UTC
README
Authorizo
Authorizo is a lightweight role and permission management package for Laravel. It provides database tables, a role relationship for your user model, an authorization middleware, an installer command, and a simple admin UI for managing roles and assigning them to users.
Requirements
- PHP 8.3 or higher
- Laravel 12 or 13
Installation
Install the package via Composer:
composer require saeedaz19/authorizo
Publish and run the migrations:
php artisan vendor:publish --tag="authorizo-migrations"
php artisan migrate
Add the HasAuthorizo trait to your user model:
use Authorizo\Authorizo\Traits\HasAuthorizo; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use HasAuthorizo; }
Run the installer command:
php artisan authorizo:install
The installer scans routes that use the authorizo middleware, creates permissions from their controller and action names, and creates the default admin and user roles.
Configuration
You may publish the configuration file:
php artisan vendor:publish --tag="authorizo-config"
Admin UI
Authorizo registers its admin routes automatically under the admin prefix:
/admin/authorizo
/admin/role
/admin/role/create
/admin/assign
The package also registers the authorizo middleware alias. Routes protected by this middleware are checked against the authenticated user's role permissions.
use App\Http\Controllers\PostController; use Illuminate\Support\Facades\Route; Route::middleware(['web', 'auth', 'authorizo'])->group(function () { Route::get('/posts', [PostController::class, 'index']); Route::post('/posts', [PostController::class, 'store']); });
For a controller action such as PostController@index, Authorizo looks for a permission with the slug:
post.index
Publishing Resources
Publish all package resources:
php artisan vendor:publish --tag="authorizo"
Or publish only what you need:
php artisan vendor:publish --tag="authorizo-config" php artisan vendor:publish --tag="authorizo-migrations" php artisan vendor:publish --tag="authorizo-views" php artisan vendor:publish --tag="authorizo-lang"
Testing
Run the package test suite:
composer test
You may also run the checks individually:
composer analyse composer lint:check composer test:types composer test:unit
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Thank you for considering contributing to Authorizo! Please review our contributing guide to get started.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
Authorizo is open-sourced software licensed under the MIT license.