PHPackages                             xrazerz/rbac - 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. xrazerz/rbac

ActiveLibrary

xrazerz/rbac
============

Create a Comprehensive RBAC System For Laravel that allows for more granular control over user permissions

00PHP

Since Jul 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xrazerz/laravel-rbac)[ Packagist](https://packagist.org/packages/xrazerz/rbac)[ RSS](/packages/xrazerz-rbac/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel RBAC System
===================

[](#laravel-rbac-system)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)

Introduction
------------

[](#introduction)

This package provides a comprehensive Role-Based Access Control (RBAC) system for Laravel, allowing for more granular control over user permissions. It is designed to be flexible and easy to integrate into your Laravel application.

Features
--------

[](#features)

- Define roles and permissions.
- Assign roles to users.
- Check user permissions easily.
- Middleware for route protection.
- Artisan commands for managing roles and permissions.

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

[](#installation)

1. Install the package via Composer:

    ```
    composer require xrazerz/laravel-rbac
    ```
2. Publish the configuration file and migrations:

    ```
    php artisan vendor:publish --provider="Dev\Rabc\Providers\RabcServiceProvider"
    ```
3. Run the migrations:

    ```
    php artisan migrate
    ```

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can find it at `config/rbac.php`. Customize it according to your needs.

Usage
-----

[](#usage)

### Defining Roles and Permissions

[](#defining-roles-and-permissions)

You can define roles and permissions in your database or using the provided Artisan commands.

```
# Create a role
php artisan rbac:create-role admin

# Create a permission
php artisan rbac:create-permission view-dashboard
```

### Assigning Roles to Users

[](#assigning-roles-to-users)

You can assign roles to users using the `assignRole` method.

```
$user = User::find(1);
$user->assignRole('admin');
```

### Checking Permissions

[](#checking-permissions)

You can check if a user has a specific permission using the `can` method.

```
if ($user->can('view-dashboard')) {
    // The user can view the dashboard
}
```

### Middleware

[](#middleware)

You can protect your routes using the provided middleware.

```
Route::group(['middleware' => ['role:admin']], function () {
    Route::get('/admin', 'AdminController@index');
});
```

Contributing
------------

[](#contributing)

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Make your changes.
4. Commit your changes (`git commit -m 'Add some feature'`).
5. Push to the branch (`git push origin feature-branch`).
6. Open a pull request.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](MIT) file for details.

Contact
-------

[](#contact)

Ismail Mohamed -

Project Link:

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity18

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f44df6557fbf96fc0cdfde3be2103a6192c95536e7a5d6c36f360935021e17dc?d=identicon)[devsi](/maintainers/devsi)

![](https://www.gravatar.com/avatar/bbfa9c1c6899b0d6fa41f11b70653cb0b2e325d92296bc2b3095f02c4a991071?d=identicon)[xrazerz](/maintainers/xrazerz)

---

Top Contributors

[![ismail0x01](https://avatars.githubusercontent.com/u/112773490?v=4)](https://github.com/ismail0x01 "ismail0x01 (1 commits)")

### Embed Badge

![Health badge](/badges/xrazerz-rbac/health.svg)

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

PHPackages © 2026

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