Download the PHP package dynamik-dev/laravel-policy-engine without Composer
On this page you can find all versions of the php package dynamik-dev/laravel-policy-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dynamik-dev/laravel-policy-engine
More information about dynamik-dev/laravel-policy-engine
Files in dynamik-dev/laravel-policy-engine
Package laravel-policy-engine
Short Description A Laravel-native scoped permissions package. Composable, contract-driven authorization that integrates with Gates, Policies, middleware, and Blade.
License MIT
Informations about the package laravel-policy-engine
A letter of marque was a document issued by a government that turned pirates into privateers, granting them scoped permission to plunder in specific waters. This package does the same thing for Laravel (minus the plundering). A user can be an admin in one team and a viewer in another. Deny rules, permission boundaries, and JSON policy documents are built in. The whole thing plugs into Laravel's Gate.
Quick look
Roles, boundaries, and deny rules can live in JSON files you import at deploy time:
Features
Wired into the Gate
$user->can(), @can, $this->authorize(), and can: middleware all work without any extra wiring.
Deny rules
Prefix any permission with !. The denial overrides every other role that grants it.
Permission boundaries
Boundaries set a ceiling on what any role can do inside a scope. A user with admin in a free-tier org still can't access pro-tier features. Pass a scope string or any Scopeable model.
Wildcards
Resource policies
Attach authorization rules directly to a resource type. The when() closure receives the user and the resource instance.
Contract-driven
Every component implements a PHP interface. You can swap any implementation through the service container. See Swapping implementations.
Why not Spatie?
Spatie laravel-permission works well for flat RBAC. Marque adds scoped roles, deny rules, permission boundaries, and declarative policy documents. See the full comparison.
Requirements
| Dependency | Supported Versions |
|---|---|
| PHP | 8.4, 8.5 |
| Laravel | 12, 13 |
| PostgreSQL | 17+ |
| SQLite | 3.35+ |
| Valkey / Redis | 8+ |
SQLite works out of the box for development. PostgreSQL and Valkey are optional — the package tests against both in CI. MySQL is not officially supported but should work fine since Laravel's query builder abstracts the differences.
Documentation
Getting Started — Seeding permissions and roles
Authorization — Resource policies
Integrations — Sanctum
Policy Documents — Import / Export
Extending — Cache
Testing — Testing authorization
Reference — Comparison with Spatie
All versions of laravel-policy-engine with dependencies
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0