Download the PHP package curly-deni/laravel-permission-policy without Composer
On this page you can find all versions of the php package curly-deni/laravel-permission-policy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download curly-deni/laravel-permission-policy
More information about curly-deni/laravel-permission-policy
Files in curly-deni/laravel-permission-policy
Package laravel-permission-policy
Short Description A lightweight Laravel package for reusable, trait-based policy checks supporting CRUD, ownership, and private resource access.
License MIT
Homepage https://github.com/curly-deni/laravel-permission-policy
Informations about the package laravel-permission-policy
Laravel Permission Policy
A simple and flexible way to define and apply CRUD policies in Laravel using traits.
Designed to work seamlessly with laravel-permission-maker
🎯
✨ Features
- ✅ Out-of-the-box CRUD permission checks
- 🔒 Support for private resource visibility
- 👤 Ownership-based access control
- 🧩 Easy integration using traits
- ⚙️ Configurable behavior via simple settings
📦 Installation
Install the package via Composer:
⚙️ Configuration
After publishing the config file with:
You’ll get the following settings in config/permission-policy.php
:
🛠️ Note: If you disable the automatic
gate
registration ('register_gate' => false
), make sure your custom gate implementation supports passing policy arguments via query parameters. You can use the included helper functions to handle this:
encodeClassWithParams(string $class, array $params): string
Encodes a class name and arguments into a query-safe string.decodeClassWithParams(string $encoded): array
Decodes the encoded string back into the original class name and parameters.
🚀 Usage
This package is intended to be used with laravel-permission-maker.
Choose the trait that suits your needs:
Trait | Description |
---|---|
HasResourcePolicy |
Basic CRUD permission checks |
HasPrivateResourcePolicy |
Adds private resource view checks |
HasOwnResourcePolicy |
Enables edit/delete for own resources |
HasOwnAndPrivateResourcePolicy |
Combines ownership and private access |
🤝 Contributing
See CONTRIBUTING.md for contribution guidelines.
🙌 Credits
- Danila Mikhalev
- All Contributors
📄 License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-permission-policy with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
illuminate/auth Version ^10.0||^11.0||^12.0
illuminate/database Version ^10.0||^11.0||^12.0
spatie/laravel-permission Version ^6.17