PHPackages                             ohhink/rrm - 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. ohhink/rrm

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

ohhink/rrm
==========

Laravel RBAC based on Laravel-Permission with backend UI

1.1.9(5y ago)3124MITJavaScriptPHP ^7.2

Since Jun 7Pushed 5y agoCompare

[ Source](https://github.com/ouhaohan8023/rrm)[ Packagist](https://packagist.org/packages/ohhink/rrm)[ RSS](/packages/ohhink-rrm/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Laravel Rbac
============

[](#laravel-rbac)

[![standard-readme compliant](https://camo.githubusercontent.com/4d148b38f9c13f71b15b80f0bd583698fd5a5ab9bd7dfe61d40e1e30aec35399/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726561646d652532307374796c652d7374616e646172642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/RichardLitt/standard-readme)

**[English](https://github.com/ouhaohan8023/rrm/blob/master/README.md)****[中文](https://github.com/ouhaohan8023/rrm/blob/master/README.cn.md)**

> This Package is used for rules controller which based on roles

This package is based on [Laravel Permission](https://github.com/spatie/laravel-permission.git) and can build a rule controller panel with UI in few minutes.

Server Requirements：

1. Php &gt;= 7.2
2. Laravel Version &gt;= 6.1 &amp;&amp; &lt; 7.0 （Not Support for Laravel Version &gt;= 7.0 , will update soon）

what include
------------

[](#what-include)

- [Const](#Const)
- [Why I do this](#Why-I-do-this)
- [Installation](#Installation)
- [How to use](#How-to-use)
- [Related Efforts](#Related-Efforts)
- [Maintainers](#Maintainers)
- [Contributing](#Contributing)
- [License](#License)

Const
-----

[](#const)

The **rule** in this novel can be regards as **route** in Laravel

Why I do this
-------------

[](#why-i-do-this)

Word is cheap , show me the code !

[Laravel Permission](https://github.com/spatie/laravel-permission.git) is a very good package without UI. So, this package is add UI on the laravel permission package and do some things to make the panel can be built quickly

What Include：

1. **Rule** controller based on **Role** , you can add more than one roles to a user .
2. Add more than one rules to a role .
3. Menus can be different as it depends on the rules the user have .
4. Write your new rules in the `routes/web.php` and it can be add in the program through one button
5. Record the operation, you can choose to use job to do it sync/async
6. Backend ui panel
7. Google Authenticator

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

[](#installation)

> Recommend to use new Laravel Project Remember to open `exec` ，`shell_exec`，`proc*` functions in `php.ini`

Update the local configure file `.env`

```
# change database and key
# change cache
CACHE_DRIVER=redis
REDIS_CLIENT=predis
# suggest
QUEUE_CONNECTION=redis
# google authenticator
GOOGLE_AUTHENTICATOR=false
```

Run the command in the root of your new laravel project with [composer](https://getcomposer.org/)

```
$ composer require ohhink/rrm
```

Publish the files , which include `admin.php`,`filesystems.php`,`permission.php` and front resource files and database seeds files

```
$ php artisan vendor:publish
# if you want to reload latest package seeder, run this command in force. It will remove the origin seeder , so please be careful
$ php artisan vendor:publish --tag=seeds --force
```

Build the database and run the seeder

```
# run autoload first to update the userseeder
$ composer dump-autoload
$ php artisan migrate:refresh --seed
$ php artisan db:seed --class=RrmDatabaseSeeder
```

Give folder right and soft-link

```
$ chmod -R 777 storage
$ php artisan storage:link
```

If you want to use Google Authenticator, you have to add this provider and aliases by yourself

```
// config/app.php

'providers' => [
    //........
    Earnp\GoogleAuthenticator\GoogleAuthenticatorServiceprovider::class,
    SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,
],

'aliases' => [
     //..........
    'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
],
```

That's it !

How to use
----------

[](#how-to-use)

- The default of the backend route is `/admin`, this can be change though the `config/admin.php`The seeder have already make a super admin user , which account is below

    ```
    account : admin@gmail.com
    password : admin&%@cv..
    ```
- What's RBAC talk about is , assign one or more rules to a role and assign one or more roles to a user. We can controller rules with a role , which we normally do rather than a detail rule. So , there is few steps you have to do with your business logic

    1. finish your code and add your routes in the route/web.php like you normally do
    2. click the **Route Reload** . For example , we get the new route **admin.test**
    3. create or update your translate files in the path **resources/vendor/rrm/zh-cn/permission.php**
    4. assign this new route to a role , like **admin**
    5. if this new route is a menu function, you should create a new menu and rebuild the menu otherwise the new menu will not display
- If you want to rewrite the route , you should add below to you **route/web.php**

    ```
    # this is rewrite the route to your app/Http/Controllers/IndexController.php index()

    Route::prefix(config('admin.prefix'))->middleware([
        'auth',
        'admin'
    ])->name('admin.')->group(function () {
        Route::get('/', 'IndexController@index')->name('index');
    });

    ```

    In your **app/Http/Controllers/IndexController.php** file ，you should add below

    ```

    public function index()
    {
        // put your code here !!!
        // recover the view in /resources/views/vendor/rrm/admin/index.blade.php
        // OR you can just run command below, it will create blade files automatically
        // php artisan vendor:publish --tag=views --force
        return view('rrm::admin.index');
    }

    ```
- To see the online-user in the right bar , you have to add command in the **app/Console.Kernel.php** file, like this

    ```
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
        $schedule->command('admin-tool:cache-online-users')->everyMinute();
    }

    ```

    And Remember To Add Command In Your Server

    ```
    * * * * * php /home/vagrant/blade_package/artisan schedule:run >> /dev/null 2>&1

    ```
- Since it record every step user did on panel, if you want to do it async, you can change the key val `QUEUE_CONNECTION=sync` in `.env` files to `QUEUE_CONNECTION=redis`This will make the recorder use jobs to async log the operations which will be faster. Of course you have to add Redis or PRedis package first
- If you want to change **500** page, you can create a **resource/views/vendor/rrm/500.blade.php** to rewrite that.
- Listen Queue Command

    ```
    php artisan queue:work --queue=logs --sleep=3 --tries=3

    # prefer to use supervisor
    # supervisor config file -- laravel-worker.conf

    [program:logs]
    process_name=%(program_name)s_%(process_num)02d
    command=php path_to/artisan queue:work --queue=logs --sleep=3 --tries=3
    autostart=true
    autorestart=true
    user=root
    numprocs=2
    redirect_stderr=true
    stdout_logfile=path_to/supervisor/logs.log

    save and run ** supervisorctl reload ** to reload it

    ```
- The layout of this package, you can use it though the follow code.

    ```
     @extends('rrm::admin.layout')

     @section('content')

                 @if (Session::has('success'))
                     @include('rrm::admin.layout.success',['msg'=>Session::get('success')])
                 @endif
                 @if (Session::has('error'))
                     @include('rrm::admin.layout.error',['msg'=>Session::get('error')])
                 @endif

     @endsection

     @section('js')
     @endsection
     @section('css')
     @endsection

    ```
- Use Google Authenticator

    ```
    # First , add config to the file .env
    GOOGLE_AUTHENTICATOR=true

    # After that, no matter which page the user going to visit , he will redirect to GOOGLE AUTHENTICATOR PAGE.
    # Follow the step and it will redirect to the normal page after register.
    # If you what to vertify in your code , you can learn from the fake code.
    public function index()
    {
         // $google code which is  registered before
         // $vertify code to be verified
         if (\OhhInk\Rrm\Model\Google::CheckCode($google, $vertify)) {
                 // pass
         } else {
                 // fail
         }
    }

    ```

Related Efforts
---------------

[](#related-efforts)

- [Laravel Permission](https://github.com/spatie/laravel-permission.git) - Associate users with permissions and roles

Maintainers
-----------

[](#maintainers)

[@OhhInk](https://github.com/ouhaohan8023).

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

[](#contributing)

Feel free to dive in! Open an issue or submit PRs.

Standard Readme follows the Contributor Covenant Code of Conduct.

License
-------

[](#license)

[MIT](LICENSE) © OhhInk

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

2171d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54025700740179725e05152c2b05eb32b2c33841cc7337cd1be0125749a1b6dd?d=identicon)[ohhink](/maintainers/ohhink)

---

Top Contributors

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

---

Tags

laravelsecuritypermissionrolespermissionsrbac

### Embed Badge

![Health badge](/badges/ohhink-rrm/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[wnikk/laravel-access-rules

Simple system of ACR (access control rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.

103.6k1](/packages/wnikk-laravel-access-rules)

PHPackages © 2026

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