Installation
Requirements
Section titled “Requirements”| PHP | 8.2 or newer |
| Laravel | 11 or 12 |
| Database | PostgreSQL, MySQL / MariaDB, or SQLite |
Warrant compiles rules into SQL for those three driver families. Any database your app already runs on Laravel 11/12 with one of those drivers will work.
Install
Section titled “Install”composer require patrickhanna/laravel-warrantThe service provider is registered automatically through Laravel’s package
discovery — there is nothing to add to config/app.php.
Publish the config
Section titled “Publish the config”Warrant reads two settings from config/warrant.php: which resolver supplies
your rules, and which schemas exist. Publish the file so you can edit it in place:
php artisan vendor:publish --tag=warrant-configThis writes config/warrant.php:
return [ // The class that hands Warrant the rules for the current request. // Warrant ships NO default — you must set this. 'rule_resolver' => App\Warrant\DatabaseRuleResolver::class,
// Every schema Warrant should know about. 'schemas' => [ App\Warrant\DocumentSchema::class, ],];What you’ll build
Section titled “What you’ll build”Warrant has four moving parts. Installing the package only gives you the engine; the four pieces below are yours to write:
- A schema per resource — the vocabulary of abilities and conditions.
- Rules in Warrant’s rule language — the actual policy, stored as data.
- A resolver — the glue that fetches this user’s rules at request time.
- The checks in your app — query scopes, model helpers, and middleware.
The Quick start walks through the smallest version of all four.
