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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-policy-engine

Pint Larastan Pest PHPStan Level 9

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

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dynamik-dev/laravel-policy-engine contains the following files

Loading the files please wait ...