Download the PHP package vortexpanel/policy-permission-sync without Composer
On this page you can find all versions of the php package vortexpanel/policy-permission-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vortexpanel/policy-permission-sync
More information about vortexpanel/policy-permission-sync
Files in vortexpanel/policy-permission-sync
Package policy-permission-sync
Short Description Sync Laravel Policies to Spatie permissions using dot-style naming.
License MIT
Informations about the package policy-permission-sync
VortexPanel — Policy Permission Sync
Sync Laravel Policies into Spatie permissions using deterministic names (configurable):
posts.view_anyposts.viewposts.createposts.updateposts.delete
This is a tiny, UI-agnostic package intended to be reused by admin panels (VortexPanel, Filament, Nova, ...).
Requirements
- PHP 8.1+
- Laravel 10+
spatie/laravel-permission
Installation
Publish config:
Configuration
Edit config/policy-permission-sync.php.
The most reliable setup is to explicitly scan your policies directory:
Customize permission naming
By default, permissions are created using a dot-style pattern:
You can change it to any pattern containing {resource} and {ability}:
Notes:
- If you use
--prune, the package scopes pruning by extracting{resource}back from permission names using this same pattern. If your pattern doesn't include{resource}, pruning can't be scoped.
If your policies live in a custom directory/namespace, set the mapping:
Usage
Preview changes (no DB writes):
Apply changes:
Prune stale permissions (opt-in):
Target specific guards:
Filter resources:
Show per-permission actions:
Development & Tests (inside this package repo)
If you see PDOException: could not find driver, your PHP CLI is missing the SQLite extension.
Ubuntu/WSL:
Then:
Testing in a real Laravel app (manual)
1) Install spatie/laravel-permission and run its migrations.
2) Create a policy, e.g. app/Policies/PostPolicy.php with methods like viewAny, view, create, update, delete.
3) Ensure your config scans the right directory:
4) Run:
Then check the permissions table.
License
MIT
All versions of policy-permission-sync with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/filesystem Version ^10.0|^11.0|^12.0
spatie/laravel-permission Version ^6.0