PHPackages                             budhaspec/rolepermission - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. budhaspec/rolepermission

ActivePackage[Authentication &amp; Authorization](/categories/authentication)

budhaspec/rolepermission
========================

Allow admin to create module/sub module and assign a permissions to user. User can then access module as per the permission assigned to them.

v1.0.0(10mo ago)02MITBladeCI passing

Since Jul 7Pushed 10mo agoCompare

[ Source](https://github.com/budha-spec/rolepermission)[ Packagist](https://packagist.org/packages/budhaspec/rolepermission)[ RSS](/packages/budhaspec-rolepermission/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Getting started
---------------

[](#getting-started)

Please check the official laravel installation guide for server requirements before you start. [Official Documentation](https://laravel.com/docs/11.x/installation)

About RolePermission
--------------------

[](#about-rolepermission)

```
A lightweight and customizable Role & Permission management system tailored for Laravel admin panels—built with no third-party dependencies.
You can define your own modules and sub-modules, create custom roles, and assign specific permissions to those roles.
Once permissions are set, simply assign the role to a user to control access.

```

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require budhaspec/rolepermission

```

Run the database migrations (ensure your .env file is configured properly):

```
php artisan migrate

```

Publish the public assets:

```
php artisan vendor:publish --tag=public

```

Update user model as below.

```
use Budhaspec\Rolepermission\Models\Role;

Add 'role_id' in $fillable array.

Add below relationship.

public function role() {
    return $this->belongsTo(Role::class, 'role_id');
}

```

Start the local development server:

```
php artisan serve

```

You can now access the server at

Usage
-----

[](#usage)

Middleware &amp; Route Protection
---------------------------------

[](#middleware--route-protection)

Configure middleware in bootstrap/app.php

```
use Budhaspec\Rolepermission\Http\middleware\CheckPermission;

->withMiddleware(function (Middleware $middleware) {
      $middleware->alias([
          'role-permission' => CheckPermission::class,
      ]);
  })

```

Wrap any routes you want protected by roles and permissions inside the role-permission middleware:

```
Route::middleware(['auth', 'role-permission'])->group(function () {
	  Route::get('/product/list', fn () => 'Outer Product List')->name('product.list');
    Route::get('/product/add', fn () => 'Outer Product add')->name('product.add');
});

```

Only users with the appropriate role and permission will be able to access the routes inside this group.

Modules
-------

[](#modules)

Manage modules and sub-modules from:

This section allows you to define features (modules) and their actions (sub-modules) that need to be permission-controlled.

Roles
-----

[](#roles)

Manage roles and assign permissions via:

From here, you can:

- Create and edit roles
- Assign module and sub-module permissions to roles
- Assign roles to users

Permissions Mapping Convention
------------------------------

[](#permissions-mapping-convention)

```
Important: THE NAMED ROUTE MUST MATCH THE MODULE.SUB-MODULE NAME; otherwise, IT WON'T WORK.

```

From the roles section you can manage roles, Assign permissions (module/sub module) to specific role by clicking on 'Assign Permission' button.

You can assign that Role to specific users for given a grant of that module/sub module.

```
Suppose product is module and list, add, edit and delete are sub modules assigned to manager role.
Manager role assigned to budha.test@gmail.com user then that user can access product and it's
sub module list, add, edit and delete routes.

 Consider the below test cases for product module.

 Correct Format:
 	Route::get('/product/list', fn () => 'Product List')->name('product.list');

 Incorrect Formats:
  	Route::get('/product/list', fn () => 'Product List')->name('product.listing');  // Invalid
	  Route::get('/product/list', fn () => 'Product List')->name('products');         // Invalid

 ------------------------------------------------------------------------------------------------------------------------

 | Module  | Sub-Module | Valid Route Name | Invalid Examples                      |
 | ------- | ---------- | ---------------- | ------------------------------------- |
 | product | list       | `product.list`   | `product.listing`, `products.listing` |
 | product | add        | `product.add`    | `product.create`, `product.insert`    |
 | product | edit       | `product.edit`   | `product.update`                      |
 | product | delete     | `product.delete` | `product.destroy`, `product.remove`   |

 Important: In short, named route must be module.sub module name like 'product.list' then it will work.

 Example:
	If the module is product and sub-module is edit, then the named route must be product.edit

	Route::get('/product/{id}/edit', fn () => 'Edit Product')->name('product.edit'); // ✅ Valid

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance55

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

313d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06a8a5aff908fd0365a3fdaccd14514e416a0d81ba5fb392a7a6abfd675c8851?d=identicon)[budha.jethava](/maintainers/budha.jethava)

---

Top Contributors

[![budha-spec](https://avatars.githubusercontent.com/u/176588049?v=4)](https://github.com/budha-spec "budha-spec (7 commits)")

### Embed Badge

![Health badge](/badges/budhaspec-rolepermission/health.svg)

```
[![Health](https://phpackages.com/badges/budhaspec-rolepermission/health.svg)](https://phpackages.com/packages/budhaspec-rolepermission)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
