PHPackages                             ahmdrv/laravel-permission-registry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ahmdrv/laravel-permission-registry

ActiveLibrary

ahmdrv/laravel-permission-registry
==================================

A code-first permission resource registry and synchronization toolkit for Spatie Laravel Permission.

v1.0.1(yesterday)06↑2900%MITPHP ^8.3

Since Jul 22Compare

[ Source](https://github.com/ahmadrivaldi-arv/laravel-permission-registry)[ Packagist](https://packagist.org/packages/ahmdrv/laravel-permission-registry)[ Docs](https://github.com/ahmadrivaldi-arv/laravel-permission-registry)[ GitHub Sponsors](https://github.com/Ahmdrv)[ RSS](/packages/ahmdrv-laravel-permission-registry/feed)WikiDiscussions Synced today

READMEChangelog (2)Dependencies (18)Versions (3)Used By (0)

Laravel Permission Registry
===========================

[](#laravel-permission-registry)

[![Tests](https://github.com/ahmadrivaldi-arv/laravel-permission-registry/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ahmadrivaldi-arv/laravel-permission-registry/actions/workflows/run-tests.yml)[![PHPStan](https://github.com/ahmadrivaldi-arv/laravel-permission-registry/actions/workflows/phpstan.yml/badge.svg)](https://github.com/ahmadrivaldi-arv/laravel-permission-registry/actions/workflows/phpstan.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/78c868160f4665486e522473806c9e2533b206c1c1bb6ee800f748d60743411d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d6472762f6c61726176656c2d7065726d697373696f6e2d72656769737472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ahmdrv/laravel-permission-registry)

A headless, code-first registry for defining, discovering, validating, inspecting, and synchronizing permissions backed by [spatie/laravel-permission](https://spatie.be/docs/laravel-permission). It gives authorization capabilities a deterministic source of truth while leaving persistence, Laravel Gate integration, role-derived access, and direct access calculation to Spatie.

This package does not replace Laravel authorization. It does not provide a UI, couple resources to Eloquent models, infer access, or generate policies. A permission resource is an authorization domain such as products, dashboards, reports, settings, or imports.

Documentation
-------------

[](#documentation)

- [Documentation index](docs/README.md)
- [Installation and first setup](docs/installation.md)
- [Configuration](docs/configuration.md)
- [Permission resources, presets, and metadata](docs/resources.md)
- [Advisory recommendations](docs/recommendations.md)
- [Registry registration, discovery, and queries](docs/registry.md)
- [Artisan command reference](docs/commands.md)
- [Role and user management services](docs/management.md)
- [Seeding permissions, roles, and user assignments](docs/seeding.md)
- [Laravel Gate, policies, Blade, and Livewire](docs/authorization.md)
- [Events, exceptions, and troubleshooting](docs/events-and-troubleshooting.md)
- [Deployment and operational safety](docs/operations.md)

Requirements and installation
-----------------------------

[](#requirements-and-installation)

- PHP 8.3 or newer
- Laravel 10, 11, 12, or 13
- `spatie/laravel-permission` 6.10 or newer within version 6

Install both packages, publish Spatie's configuration and migrations, and migrate according to Spatie's documentation:

```
composer require ahmdrv/laravel-permission-registry
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan migrate
```

This package owns no database tables or migrations. Publish its focused configuration with:

```
php artisan vendor:publish --tag="laravel-permission-registry-config"
```

The defaults discover resources under `app/Authorization/Permissions`, use Laravel's default guard when `guard` is `null`, and disable direct user permissions.

Defining resources
------------------

[](#defining-resources)

Generate a resource:

```
php artisan rbac:make-resource Product
php artisan rbac:make-resource Product --key=products --group=catalog --preset=crud
```

`--preset` accepts `crud`, `read-only`, or `none`; `--force` follows normal generator overwrite behavior. Use `--key` when Laravel's English pluralizer is unsuitable. Generated resources contain no redundant standard action declarations.

A complete resource can add an action and selectively override metadata on a preset action:

```
