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

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

nelisys/rbac
============

Nelisys RBAC for Laravel

v0.0.3(5y ago)016MITPHP

Since Oct 17Pushed 5y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Nelisys RBAC for Laravel
========================

[](#nelisys-rbac-for-laravel)

 [![Total Downloads](https://camo.githubusercontent.com/33d615b06f8d38c531145e7b366c4599b4dc4eabd460f830d967b7e5f865b2e4/68747470733a2f2f706f7365722e707567782e6f72672f6e656c697379732f726261632f642f746f74616c2e737667)](https://packagist.org/packages/nelisys/rbac)

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

[](#introduction)

Role-Based Access Control for Laravel.

Default the package will use `username` column to authenticate. If you want to use `email` instead, just change `username` to `email` in `config/nelisys/rbac.php`.

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

[](#installation)

Run composer to install the package.

```
composer require nelisys/rbac

```

Publish the configuration files.

```
php artisan vendor:publish --provider="Nelisys\Rbac\RbacServiceProvider"

```

Change `users.model` to `Nelisys\Rbac\Models\User`

```
// config/auth.php
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => Nelisys\Rbac\Models\User::class,
        ],
```

Add sanctum config in `.env` file

```
SANCTUM_STATEFUL_DOMAINS=example.com

```

Add Sanctum middleware in `api`.

```
// app/Http/Kernel.php
    protected $middlewareGroups = [
        'api' => [
            \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
```

Run migrate.

```
php artisan migrate

```

Create Test User
----------------

[](#create-test-user)

Run `php artisan tinker` to create test user.

```
Nelisys\Rbac\Models\User::create([
    'username' => 'alice',
    'password' => bcrypt('secret'),
]);

```

Test API by curl
----------------

[](#test-api-by-curl)

### API Login

[](#api-login)

Call `/api/login` to get the token.

```
$ curl \
    -H 'X-Requested-With: XMLHttpRequest' \
    -d 'username=alice&password=secret' \
    http://example.test/api/login

```

### API Authorization

[](#api-authorization)

Specify header `Authorization: Bearer` with the token return.

Note: Replace `$token` with the token return.

```
$ curl \
    -H 'X-Requested-With: XMLHttpRequest' \
    -H 'Authorization: Bearer $token' \
    http://example.test/api/user

{
  "username" : "alice",
  "id" : 1,
  ...
}

```

### API Logout

[](#api-logout)

Specify header `Authorization: Bearer` with the token return.

Note: Replace `$token` with the token return.

```
$ curl \
    -X POST \
    -H 'X-Requested-With: XMLHttpRequest' \
    -H 'Authorization: Bearer $token' \
    http://example.test/api/logout

```

License
-------

[](#license)

Nelisys RBAC is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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 ~37 days

Total

3

Last Release

1963d ago

### Community

Maintainers

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

---

Top Contributors

[![supasin](https://avatars.githubusercontent.com/u/19340819?v=4)](https://github.com/supasin "supasin (17 commits)")

---

Tags

laraveluserpermissionrbacrole

### Embed Badge

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

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[casbin/laravel-authz

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

324339.9k4](/packages/casbin-laravel-authz)[yajra/laravel-acl

Laravel ACL is a simple role, permission ACL for Laravel Framework.

112103.9k1](/packages/yajra-laravel-acl)[efficiently/authority-controller

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

15533.2k](/packages/efficiently-authority-controller)[hasinhayder/tyro

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

6712.1k2](/packages/hasinhayder-tyro)[klaravel/ntrust

Role-Based Permissions for Laravel 5.3+

10126.7k1](/packages/klaravel-ntrust)

PHPackages © 2026

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