Download the PHP package njbm/role-permission without Composer
On this page you can find all versions of the php package njbm/role-permission. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download njbm/role-permission
More information about njbm/role-permission
Files in njbm/role-permission
Package role-permission
Short Description A simple, robust role-permission package for Laravel (one role per user).
License MIT
Homepage https://github.com/njbm/role-permission
Informations about the package role-permission
🔐 Laravel Role-Permission Package (One Role Per User)
A simple, robust, and easy-to-manage Laravel role-permission system (one role per user) — no external dependencies like Spatie.
Built and maintained by Jaber Masud
📦 Installation
Option 1: Install from GitHub (Packagist style)
Update
Specific Virsion
Remove package
⚙️ Configuration
Step 1: Add service provider and alias (optional for Laravel < 5.5)
Step 2: Publish the config file
🛠 Database Setup
Step 1: Migrate Tables
Step 2: Seed Default Roles and Permissions
🔐 Seeder uses config('role-permission.default_roles') to assign permissions to each role.
🧠 Model Setup
Add trait to your Admin or User model (must have role_id column):
✅ Usage
Use the AccessControl facade anywhere to check permissions or roles:
🛡 Middleware setup
Add middleware to app/Http/Kernel.php:
Use middleware on routes:
🧩 Blade directive (optional)
Register in AppServiceProvider:
Use in Blade templates:
⚙ Example config/role-permission.php
📜 Summary
Install package via composer
Publish config and migrate database tables
Seed default roles and permissions
Add trait to your User/Admin model
Use AccessControl facade for permission checks
Protect routes with middleware
Use optional Blade directive for cleaner views
📄 License
MIT License — created by Jaber Masud
jaber.netlify.app