PHPackages                             denchotsanov/yii2-user-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. denchotsanov/yii2-user-rbac

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

denchotsanov/yii2-user-rbac
===========================

v0.3.7(6y ago)055MITPHPPHP ^7.0

Since May 23Pushed 6y agoCompare

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

READMEChangelog (9)Dependencies (5)Versions (10)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 RBAC USER Extension
========================

[](#yii2-rbac-user-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/9c184949acfb597915cd4a034c4c419dc754aea5569700905a11388d455c6fce/68747470733a2f2f706f7365722e707567782e6f72672f64656e63686f7473616e6f762f796969322d757365722d726261632f762f737461626c65)](https://packagist.org/packages/denchotsanov/yii2-user)[![Total Downloads](https://camo.githubusercontent.com/8825612ce3f870405bdf7d649a713959b82975f670aa7821ee00269742754f85/68747470733a2f2f706f7365722e707567782e6f72672f64656e63686f7473616e6f762f796969322d757365722d726261632f646f776e6c6f616473)](https://packagist.org/packages/denchotsanov/yii2-user)[![Latest Unstable Version](https://camo.githubusercontent.com/88fb3f714a2115994fd9b484dcaff184c01a2a3b5fb9cf002242b27d11bbf8e7/68747470733a2f2f706f7365722e707567782e6f72672f64656e63686f7473616e6f762f796969322d757365722d726261632f762f756e737461626c65)](https://packagist.org/packages/denchotsanov/yii2-user)[![License](https://camo.githubusercontent.com/e5dfc7756fdfe1fb940d46532d0964147d863f03ca54afe8046d21d177de6e22/68747470733a2f2f706f7365722e707567782e6f72672f64656e63686f7473616e6f762f796969322d757365722d726261632f6c6963656e7365)](https://packagist.org/packages/denchotsanov/yii2-user)

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

[](#installation)

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

Either run

```
composer require --prefer-dist denchotsanov/yii2-user-rbac "*"

```

or add

```
"denchotsanov/yii2-user-rbac ": "*"

```

to the require section of your composer.json.

Usage
-----

[](#usage)

Once the extension is installed, simply modify your application configuration as follows:

```
return [
    'modules' => [
        'rbac' => [
            'class' => 'denchotsanov\rbac\Module',
        ],
    ],
    'components' => [
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],
    ],
];
```

After you downloaded and configured Yii2-rbac, the last thing you need to do is updating your database schema by applying the migration:

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

or add in console config file

```
'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                ...
                '@yii/rbac/migrations',
                ...
            ],
        ],
    ],

```

You can then access Auth manager through the following URL:

```
[SERVER]/rbac/
[SERVER]/rbac/route
[SERVER]/rbac/permission
[SERVER]/rbac/role
[SERVER]/rbac/assignment

```

**Applying rules:**

1. For applying rules only for `controller` add the following code:

```
use denchotsanov\rbac\filters\AccessControl;

class ExampleController extends Controller
{
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::class,
                'allowActions' => [
                    'index',
                    // The actions listed here will be allowed to everyone including guests.
                ]
            ],
        ];
    }
}
```

2. For applying rules for `module` add the following code:

```
use Yii;
use denchotsanov\rbac\filters\AccessControl;

/**
 * Class Module
 */
class Module extends \yii\base\Module
{
    /**
     * @return array
     */
    public function behaviors()
    {
        return [
            AccessControl::class
        ];
    }
}
```

3. Also you can apply rules via main configuration:

```
// apply for single module

'modules' => [
    'rbac' => [
        'class' => 'denchotsanov\rbac\Module',
        'as access' => [
            'class' => denchotsanov\rbac\filters\AccessControl::class
        ],
    ]
]

// or apply globally for whole application

'modules' => [
    ...
],
'components' => [
    ...
],
'as access' => [
    'class' => denchotsanov\rbac\filters\AccessControl::class,
    'allowActions' => [
        'site/*',
        'admin/*',
        // The actions listed here will be allowed to everyone including guests.
        // So, 'admin/*' should not appear here in the production, of course.
        // But in the earlier stages of your development, you may probably want to
        // add a lot of actions here until you finally completed setting up rbac,
        // otherwise you may not even take a first step.
    ]
 ],
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

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

Every ~22 days

Recently: every ~45 days

Total

9

Last Release

2367d ago

### Community

Maintainers

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

---

Top Contributors

[![denchotsanov](https://avatars.githubusercontent.com/u/27862690?v=4)](https://github.com/denchotsanov "denchotsanov (34 commits)")

### Embed Badge

![Health badge](/badges/denchotsanov-yii2-user-rbac/health.svg)

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

###  Alternatives

[yii2mod/yii2-rbac

RBAC management module for Yii2

150351.4k7](/packages/yii2mod-yii2-rbac)

PHPackages © 2026

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