PHPackages                             s4studio/yii2-rbac-plus - 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. s4studio/yii2-rbac-plus

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

s4studio/yii2-rbac-plus
=======================

Database role base access control manager for yii2

1.1.2(6y ago)02241Apache-2.0PHP

Since Jul 23Pushed 3y agoCompare

[ Source](https://github.com/s4studio/yii2-rbac-plus)[ Packagist](https://packagist.org/packages/s4studio/yii2-rbac-plus)[ RSS](/packages/s4studio-yii2-rbac-plus/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (2)Versions (12)Used By (0)

yii2-rbac-plus
==============

[](#yii2-rbac-plus)

[![Latest Stable Version](https://camo.githubusercontent.com/7004d6387a154392c6f6ac0b1e335e96cbc92e9ae4eb74bd6545e07fec636c35/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f733473747564696f2f796969322d726261632d706c75732e737667)](https://packagist.org/packages/s4studio/yii2-rbac-plus)[![License](https://camo.githubusercontent.com/6f6ba80b498a8f0b50043da98f9178c5c5623db14e317efe46b2047c0e74d0ab/68747470733a2f2f706f7365722e707567782e6f72672f733473747564696f2f796969322d726261632d706c75732f6c6963656e7365)](https://packagist.org/packages/s4studio/yii2-rbac-plus)[![Total Downloads](https://camo.githubusercontent.com/847a13fc3466e542f82a3525c98c84553731f32da86f0e648c8babe025ca2f92/68747470733a2f2f706f7365722e707567782e6f72672f733473747564696f2f796969322d726261632d706c75732f646f776e6c6f616473)](https://packagist.org/packages/s4studio/yii2-rbac-plus)[![Monthly Downloads](https://camo.githubusercontent.com/ea3d5b9105a5d2cc496eba07cc3ce5d848c8dfb7d4fbeb51cbc2bd9364bfb203/68747470733a2f2f706f7365722e707567782e6f72672f733473747564696f2f796969322d726261632d706c75732f642f6d6f6e74686c79)](https://packagist.org/packages/s4studio/yii2-rbac-plus)[![Daily Downloads](https://camo.githubusercontent.com/08d25b6b249ce9a0a5ad3af5fbf72e01bde28dc65b94eacc8194d62d56548193/68747470733a2f2f706f7365722e707567782e6f72672f733473747564696f2f796969322d726261632d706c75732f642f6461696c79)](https://packagist.org/packages/s4studio/yii2-rbac-plus)

Database role base access control manager for yii2

Features
--------

[](#features)

- CRUD operations for roles, permissions and rules
- Allows to assign multiple roles to user
- Nice views to intergrate right away

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist s4studio/yii2-rbac-plus "dev-master"

```

or add

```
"s4studio/yii2-rbac-plus": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

1. Let 's add into modules config in your main config file

```
'components' => [
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
],
'modules' => [
    'rbac' =>  [
        'class' => 's4studio\rbacplus\Module'
    ]
]

```

Next, update the database schema

```
$ php yii migrate/up --migrationPath=@yii/rbac/migrations

```

Ok. That's done. Avaiable route now:

- /rbac/rule
- /rbac/permission
- /rbac/role
- /rbac/assignment

2. The module configuration avaible:

```
'modules' => [
    'rbac' =>  [
        'class' => 's4studio\rbacplus\Module',
        'userModelClassName' => null,
        'userModelIdField' => 'id',
        'userModelLoginField' => 'username',
        'userModelLoginFieldLabel' => null,
        'userModelExtraDataColumls' => null,
        'beforeCreateController' => null,
        'beforeAction' => null
    ]
],

```

- **userModelClassName**: The user model class.
    If you not set or set null, **RBAC Plus** will be get from `Yii::$app->getUser()->identityClass`
- **userModelIdField**: The user model id field.
    Default id field is 'id', you must set this config if primary key of user table in database is not 'id'
- **userModelLoginField** The user model login field.
    Default login field is 'username'. Maybe you use email field or something other for login. So you must change this config
- **userModelLoginFieldLabel** The user model login field label.
    If you set null the label will get from `$userModelClass->attributeLabels()[$userModelLoginField]`
- **userModelExtraDataColumls** The extra data columns you want to show in user assign views.
    The default in assignment data gridview just display id and login column data. if you want to add created\_at column you can add

```
'userModelExtraDataColumls' => [
    [
        'attributes' => 'created_at',
        'format' => 'datetime',
    ]
],
```

- **beforeCreateController** The callable before create all controller of **Rbac Plus** module. The default it is null. You need config this when you want to restrict access to **Rbac Plus** module.
    Example:

```
'beforeCreateController' => function($route) {
    /**
    *@var string $route The route consisting of module, controller and action IDs.
    */
}
```

- **beforeAction**The callable before action of all controller in **Rbac Plus** module.
    The default it is null. You need config this when you want to restrict access to any action in some controller of **Rbac Plus** module
    Example:

```
'beforeAction' => function($action) {
    /**
    *@var yii\base\Action $action the action to be executed.
    */
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 59.1% 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 ~174 days

Recently: every ~383 days

Total

11

Last Release

2205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bb0203a0513468d82ada30651fe5a49e4ed2a11276652e6e9e63636144d873c?d=identicon)[ekawalec](/maintainers/ekawalec)

---

Top Contributors

[![johnitvn](https://avatars.githubusercontent.com/u/8359652?v=4)](https://github.com/johnitvn "johnitvn (52 commits)")[![ekawalec](https://avatars.githubusercontent.com/u/9531269?v=4)](https://github.com/ekawalec "ekawalec (32 commits)")[![Evgen1986](https://avatars.githubusercontent.com/u/10276586?v=4)](https://github.com/Evgen1986 "Evgen1986 (2 commits)")[![max-dreamsoft](https://avatars.githubusercontent.com/u/16354564?v=4)](https://github.com/max-dreamsoft "max-dreamsoft (1 commits)")[![MikleUA](https://avatars.githubusercontent.com/u/8805154?v=4)](https://github.com/MikleUA "MikleUA (1 commits)")

### Embed Badge

![Health badge](/badges/s4studio-yii2-rbac-plus/health.svg)

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

###  Alternatives

[johnitvn/yii2-rbac-plus

Database role base access control manager for yii2

4855.7k1](/packages/johnitvn-yii2-rbac-plus)[rmrevin/yii2-ulogin

Extension for yii2 ulogin integration

1811.9k](/packages/rmrevin-yii2-ulogin)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

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