Download the PHP package mimaxuz/role-manager without Composer
On this page you can find all versions of the php package mimaxuz/role-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mimaxuz/role-manager
More information about mimaxuz/role-manager
Files in mimaxuz/role-manager
Package role-manager
Short Description Simple Laravel roles and permissions for Laravel applications
License MIT
Homepage https://github.com/MIMAXUZ/role-manager
Informations about the package role-manager
Simple Role Manager
An easy and flexible Laravel authorization and roles permission management.
About
In many projects, you have to work with roles and permissions. Many packages are large and not all features are needed. That's why I tried to create a small but effective package for projects. This package can be attached to any project. Convenient and efficient. It is very easy to use and can be used after installation.
Requirements
- PHP >= 8.0.2
- Laravel >= 10.0
Installation
Step 1: Install via Composer
Step 2: Run Migrations
Step 3: Publish Configuration (Optional)
This will create a config/role-manager.php file where you can customize default roles, permissions, and other settings.
Step 4: Add Trait to User Model
Open your App\Models\User model and add the HasPermissions trait:
Database Structure
This package creates the following tables with cascade relationships:

| Table | Description |
|---|---|
x_roles |
Stores role definitions (name, slug) |
x_permissions |
Stores permission definitions (name, slug) |
roles_permissions |
Pivot table linking roles to permissions |
users_roles |
Pivot table linking users to roles |
Artisan Commands
Role Management
Permission Management
Attach Permissions to Roles
Seed Default Roles & Permissions
Configuration
After publishing the config file, you can customize:
Usage
Programmatic Usage
Creating Roles & Permissions
Assigning Roles to Users
Checking Roles & Permissions
Route Middleware
Protect routes using the role middleware:
Blade Directives
@role / @endrole
@hasPermission / @endhasPermission
@hasAnyRole / @endhasAnyRole
Using Laravel's @can
Quick Start Example
Available Trait Methods
| Method | Description |
|---|---|
hasRole(...$roles) |
Check if user has any of the given roles |
hasPermissionTo($permission) |
Check if user has a specific permission |
givePermissionsTo(...$permissions) |
Assign direct permissions to user |
withdrawPermissionsTo(...$permissions) |
Remove permissions from user |
refreshPermissions(...$permissions) |
Replace all user permissions |
roles() |
Get user's roles relationship |
Changelog
v2.0.0
- Added Artisan commands for role and permission management
- Added configuration file with default roles/permissions
- Added seeding command (
role:seed) - Added new Blade directives (
@hasPermission,@hasAnyRole) - Fixed bugs in HasPermissions trait
- Laravel 10, 11, 12 support
v1.x
- Initial release with basic role/permission functionality
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Issues
If you discover any issues or bugs, please report them at GitHub Issues.
License
The MIT License (MIT). Please see License File for more information.
All versions of role-manager with dependencies
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0