PHPackages                             jumbodroid/phprbac - 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. jumbodroid/phprbac

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

jumbodroid/phprbac
==================

PHP RBAC is a wrapper around the OWASP/rbac package to support the Laravel framework

v2.0.3(4y ago)09371MITPHPPHP &gt;=7.3

Since Aug 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jumbodroid/phprbac)[ Packagist](https://packagist.org/packages/jumbodroid/phprbac)[ RSS](/packages/jumbodroid-phprbac/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (5)Versions (8)Used By (0)

phprbac
=======

[](#phprbac)

**phprbac** is wrapper around the OWASP/rbac package that adds support for the Laravel framework

> Leverage phprbac to add NIST Level 2 Authorization to your Laravel projects.

Add the provider to *config/app.php* providers array

> Jumbodroid\\PhpRbac\\ServiceProviders\\PhpRbacServiceProvider::class

Run **php artisan vendor:publish --provider="Jumbodroid\\PhpRbac\\ServiceProviders\\PhpRbacServiceProvider"** to publish the config and migration files.

Usage
=====

[](#usage)

The complete documentation can be found at [phprbac.net](http://phprbac.net/api.php "The PHP-RBAC website"). Just replace:

1. `Rbac->{Permissions}` with `Rbac->permissions()`
2. `Rbac->{Roles}` with `Rbac->roles()`
3. `Rbac->{Users}` with `Rbac->users()`
    To get an instance of the Rbac class, use `Rbac->getInstance()`

Roles
-----

[](#roles)

1. Create new role

```
$role_id = Rbac::roles()->add($title, $description);
$role_id = Rbac::roles()->add($title, $description, $parent_id);
```

2. Find role title

```
$role = Rbac::roles()->getTitle($role_id);
```

3. Find list of permissions assigned to a given role

```
$role_permissions = Rbac::roles()->permissions($role_id, true);
```

4. Unassign all permissions assigned to a given role

```
Rbac::roles()->unassignPermissions($role_id);
```

5. Assign permission to a role

```
Rbac::roles()->assign($role_id, $perm_id);
```

6. Remove a role and all its descendants

```
$ok = Rbac::roles()->remove($role_id, true);
```

7. Removes a role

```
Rbac::roles()->remove($role->ID, true);
```

Permissions
-----------

[](#permissions)

1. Create a new permission

```
$perm_id = Rbac::permissions()->add($perm_title, $perm_desc, 1);
```

2. Check if a given permission exists

```
$perm_id = Rbac::permissions()->returnId($perm_title);
```

3. Unassign all roles assigned to a given permission

```
Rbac::permissions()->unassignRoles($perm_id);
```

4. Removes a given permission

```
Rbac::permissions()->remove($perm_id, true);
```

Users
-----

[](#users)

1. Unassign a given role from all users

```
Rbac::roles()->unassignUsers($role_id);
```

2. Check if a given user has a given role

```
$assigned = Rbac::users()->hasRole($role['ID'], $user->id);
```

3. Retrieves all roles assigned to a given user

```
$assigned = Rbac::users()->allRoles($user_id);
```

4. Assign a given role to a user

```
Rbac::users()->assign($role_id, $user_id);
```

5. Unassign a given role from a user

```
Rbac::users()->unassign($role_id, $user_id);
```

UserRoles
---------

[](#userroles)

RolePermissions
---------------

[](#rolepermissions)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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

Every ~154 days

Total

5

Last Release

1469d ago

Major Versions

v1.0.0 → v2.0.02020-12-04

PHP version history (3 changes)v1.0.0PHP ^7.2.5

v2.0.0PHP ^7.3|^8.0

v2.0.3PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![rayalois22](https://avatars.githubusercontent.com/u/29088952?v=4)](https://github.com/rayalois22 "rayalois22 (31 commits)")

---

Tags

phprbacphplaravelauthorizationrbac

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jumbodroid-phprbac/health.svg)

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

###  Alternatives

[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M43](/packages/santigarcor-laratrust)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

324339.9k4](/packages/casbin-laravel-authz)[shanmuga/laravel-entrust

This package provides a flexible solution to add ACL to Laravel

68312.9k2](/packages/shanmuga-laravel-entrust)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[efficiently/authority-controller

AuthorityController is an PHP authorization library for Laravel 5 which restricts what resources a given user is allowed to access.

15433.2k](/packages/efficiently-authority-controller)[smarch/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

523.0k](/packages/smarch-watchtower)

PHPackages © 2026

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