PHPackages                             nijwel/user-roles - 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. nijwel/user-roles

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

nijwel/user-roles
=================

A user role management package for Laravel

1.0.0(1y ago)012MITPHPPHP ^8.0

Since Sep 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nijwel/user_roles)[ Packagist](https://packagist.org/packages/nijwel/user-roles)[ RSS](/packages/nijwel-user-roles/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Nijwel User Roles
=================

[](#nijwel-user-roles)

`nijwel/user-roles` is a Laravel package for managing user roles and permissions with ease. It provides a simple interface to manage user roles and permissions, integrating seamlessly with Laravel's authentication system.

You can visit github repository - [https://github.com/nijwel/user\_roles.git](https://github.com/nijwel/user_roles.git)

Features
--------

[](#features)

- **Role Management**: Create, update, and delete user roles.
- **Permission Management**: Assign and manage permissions for roles.
- **Integration with Laravel Auth**: Works with Laravel's built-in authentication system.
- **Flexible Configuration**: Customize role and permission settings.

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

[](#installation)

### Via Composer

[](#via-composer)

Install the package via Composer:

```
composer require nijwel/user-roles
```

### Migration

[](#migration)

```
php artisan migrate
```

### Publish Configuration (If Applicable)

[](#publish-configuration-if-applicable)

If the package includes configuration files, publish them using:

```
php artisan vendor:publish --provider="Nijwel\UserRoles\UserRoleServiceProvider"
```

**Note:** If you receive the message "No publishable resources for tag \[\]", it indicates there are no additional configuration files to publish. Please refer to the package documentation for further instructions.

### Configuration

[](#configuration)

Add the service provider to the providers array in your `config/app.php` file:

```
'providers' => [
    // Other service providers...
    Nijwel\UserRoles\UserRolesServiceProvider::class,
],
```

Usage
=====

[](#usage)

**Creating Roles**You can create roles using the Role model provided by the package:

Now you can insert the side-ber menu name or top-bar menu name into permissions table

**Example** : student , subcategories , products , accounts etc

Role name is input and permissions is checkbox array. you can handle from same form and post request

**\#Your Controller**

```
use Nijwel\UserRoles\Services\UserRoleService;

protected $UserRoleService;

public function __construct(UserRoleService $UserRoleService)
{
    $this->UserRoleService = $UserRoleService;
}

```

**\#Get all role**

```
UserRoleService::getAllRole();

```

**\#Get singe role**

```
UserRoleService::getRole($id);

```

**\#Store role**

```
UserRoleService::createRole($request->all());

```

**\#Update role**

```
UserRoleService::updateRole($request->all(), $id);

```

**\#delete role**

```
UserRoleService::destroyRole($id);

```

**Get all permission list.**

**NB:** permission means your side bar name

```
UserRoleService::getAllPermission();

```

**\#Get single permission**

```
UserRoleService::getPermission($id);

```

**\#Store permissions**

```
UserRoleService::createPermission($request->all());

```

**\#Update permissions**

```
UserRoleService::updatePermission($request->all(), $id);

```

**\#delete permissions**

```
UserRoleService::destroyPermission($id);

```

**\#Get All role with permission**

**NB:**  You can handle with one form

```
UserRoleService::getAllRoleWithPermission();

```

**\#Get single role with permission**

```
UserRoleService::getRoleWithPermission($id);

```

**\#Store role with permission \[ This is the array data for role and permission \]**

```
//Permissions is array value ;
UserRoleService::createRoleWithPermission($request->all());

```

**\#Update role with permission \[Array\]**

```
//Permissions is array value ;
UserRoleService::updateRoleWithPermission($request->all(), $id);

```

**\#delete role with permission**

```
UserRoleService::destroyRoleWithPermission($id);

```

### For blade file

[](#for-blade-file)

```
@if (isPermission('Employee'))

        Employee

@endif
@if (isPermission('Manager'))

        Manager

@endif
```

Use the Middleware in a Laravel Application
-------------------------------------------

[](#use-the-middleware-in-a-laravel-application)

Once the package is installed in a Laravel application, you can use the middleware in routes or controllers.

### Using Middleware in Routes:

[](#using-middleware-in-routes)

You can apply the middleware to routes like this:

```
// routes/web.php

Route::get('/admin', function () {
    // Only users with the 'admin' role can access this route
})->middleware('permission:your-permission');
```

### Using Middleware in Controllers:

[](#using-middleware-in-controllers)

You can also apply the middleware in a controller:

```
// app/Http/Controllers/AdminController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AdminController extends Controller
{
    public function __construct()
    {
        $this->middleware('permission:your-permission');
    }

    public function index()
    {
        // Your logic here
    }
}
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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

665d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/58605617?v=4)[Nazrul Islam](/maintainers/Nijwel)[@nijwel](https://github.com/nijwel)

---

Top Contributors

[![nijwel](https://avatars.githubusercontent.com/u/58605617?v=4)](https://github.com/nijwel "nijwel (8 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/nijwel-user-roles/health.svg)

```
[![Health](https://phpackages.com/badges/nijwel-user-roles/health.svg)](https://phpackages.com/packages/nijwel-user-roles)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

23.2k33.6k1](/packages/krayin-laravel-crm)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.4k](/packages/blair2004-nexopos)[inovector/mixpost-enterprise-app

Standalone application with Mixpost Enterprise's Laravel package pre-installed and configured.

109.3k](/packages/inovector-mixpost-enterprise-app)

PHPackages © 2026

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