PHPackages                             zohaib482/laravel-simple-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. zohaib482/laravel-simple-rbac

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

zohaib482/laravel-simple-rbac
=============================

Simple and lightweight Role-Based Access Control (RBAC) package for Laravel 11+ and 12 with authentication and email verification support

v0.2.4(3mo ago)27MITBladePHP ^8.2

Since Feb 12Pushed 3mo agoCompare

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

READMEChangelogDependencies (1)Versions (6)Used By (0)

Laravel Simple RBAC
===================

[](#laravel-simple-rbac)

A simple, lightweight **Role-Based Access Control (RBAC)** package for Laravel with built-in authentication and email verification support.

Features
--------

[](#features)

- Role &amp; permission management (many-to-many)
- Built-in authentication + email verification flow
- Bootstrap 5 styled auth views (login, register, verify-email, dashboard)
- Middleware: `role:admin`, `permission:manage-users`, etc.
- Blade directives: `@role`, `@permission`, `@anyrole`
- Easy integration via trait on User model
- Configurable (user model, default role, redirect paths)

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^12.0

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

[](#installation)

1. Install the package via Composer:

    ```
    composer require zohaib482/laravel-simple-rbac
    ```
2. Publish configuration, views and migrations,Seeder:

    ```
    php artisan vendor:publish --tag=simple-rbac-config
    php artisan vendor:publish --tag=simple-rbac-views
    php artisan vendor:publish --tag=simple-rbac-migrations
    ```

Seeding Roles and Permissions
-----------------------------

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

After publishing and running migrations, you need to seed the default roles and permissions:

**Publish the seeder** (if not already published):

```
php artisan vendor:publish --tag=simple-rbac-seeders
```

Run the seeder:

```
php artisan db:seed --class=RbacSeeder
```

Or add it to your DatabaseSeeder.php:

```
public function run(): void
 {
     $this->call([
         RbacSeeder::class,
         // Your other seeders...
     ]);
 }
 ```

3. Run migrations and seed default roles/permissions:

```bash
php artisan migrate

4. Add the HasRoles trait to your User model (app/Models/User.php):

```php
 use Illuminate\Contracts\Auth\MustVerifyEmail;
 use Zohaib482\SimpleRbac\Traits\HasRoles;

 class User extends Authenticatable implements MustVerifyEmail
 {
     use HasRoles;

     // ... other traits and properties
 }
```

Quick Usage Examples
--------------------

[](#quick-usage-examples)

Assign roles
------------

[](#assign-roles)

```
 $user->assignRole('admin');
 $user->assignRole('editor', 'moderator'); // multiple
```

Check roles &amp; permissions
-----------------------------

[](#check-roles--permissions)

```
$user->hasRole('admin');                        // true/false
 $user->hasAnyRole(['admin', 'editor']);
 $user->hasPermissionTo('manage-users');
```

Protect routes with middleware
------------------------------

[](#protect-routes-with-middleware)

```
 Route::middleware(['auth', 'verified', 'role:admin'])->group(function () {
     Route::get('/admin', [AdminController::class, 'index']);
 });
```

Blade directives
----------------

[](#blade-directives)

```
@role('admin')
 Welcome, Administrator!
@endrole

@permission('manage-users')
 Manage Users
@endpermission
```

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

[](#configuration)

After publishing, edit config/simplerbac.php:
---------------------------------------------

[](#after-publishing-edit-configsimplerbacphp)

```
return [
 'user_model'           => App\Models\User::class,
 'default_role'         => 'user',
 'redirect_after_login' => '/dashboard',
 'email_verification'   => true,
];
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance82

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

Total

5

Last Release

94d ago

### Community

Maintainers

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

---

Top Contributors

[![Zohaib482](https://avatars.githubusercontent.com/u/58772157?v=4)](https://github.com/Zohaib482 "Zohaib482 (14 commits)")

### Embed Badge

![Health badge](/badges/zohaib482-laravel-simple-rbac/health.svg)

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[stechstudio/laravel-jwt

Helper package that makes it easy to generate, consume, and protect routes with JWT tokens in Laravel

126117.6k](/packages/stechstudio-laravel-jwt)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

2737.5k](/packages/scaler-tech-laravel-saml2)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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