PHPackages                             romi45/yii2-rbac-collector - 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. romi45/yii2-rbac-collector

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

romi45/yii2-rbac-collector
==========================

Using extension you can organize your RBAC configuration in separate files in application modules.

1.0.8(8y ago)05.7kMITPHP

Since Apr 7Pushed 8y agoCompare

[ Source](https://github.com/agilov/yii2-rbac-collector)[ Packagist](https://packagist.org/packages/romi45/yii2-rbac-collector)[ RSS](/packages/romi45-yii2-rbac-collector/feed)WikiDiscussions master Synced 2mo ago

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

Yii 2 RBAC configuration stored in separate modules
===================================================

[](#yii-2-rbac-configuration-stored-in-separate-modules)

This extension provides layer between Yii 2 AuthManager and access configuration that can be stored in separate config classes in application modules.

It is useful for large projects where you have truckload of access rules, roles and other stuff.

When you organize your RBAC code in modules - you can easy manage it.

It is only console application component - you don't have to change something in your web application - just use Yii::$app-&gt;authManager as you used it before.

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

[](#installation)

Install this extension through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require romi45/yii2-rbac-collector:~1.0
```

or add

```
"romi45/yii2-rbac-collector": "~1.0"

```

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

Configuring
-----------

[](#configuring)

Add rbacc module into your modules section in *console application* config.

```
'modules' => [
    ...
    'rbacc' => [
        'class' => 'rbacc\Module',
        'collection' => [
            // Here is a list of your RBAC config classes. Example you can get in /example directory
            'app\modules\user\rbac\Config',
            'app\modules\blog\rbac\Config',
            'app\modules\hobby\rbac\YouCanNameItAsYouWant',
        ]
    ],
    ...
]
```

Here is an example of config class. array keys - auth item name value - auth item data

if value is not array - collector recognize it as Permission. if value is array - you have to specify type of Item

```
namespace rbacc\example;

use rbacc\components\ConfigBase;
use rbacc\example\rules\UpdateOwnDataRule;
use yii\rbac\Item;

/**
 * Class Config
 *
 * Example RBAC configuration class
 *
 * @package user\rbac
 */
class Config extends ConfigBase
{
    /**
     * Gets config data as array
     *
     * @return array
     */
    public function getData()
    {
        return [
            'user___user__view_profile' => 'View user profile',
            'user___user__view_own_profile' => [
                'type' => Item::TYPE_PERMISSION,
                'description' => 'View user own profile',
                'rule' => new UpdateOwnDataRule(),
                'children' => ['user___user__view_profile']
            ],
            'user' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'User',
                'children' => ['user___user__view_own_profile'],
            ],
            'admin' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Admin',
                'children' => ['user___user__view_profile']
            ],
            'owner' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Application owner',
                'children' => ['admin'],
            ]
        ];
    }
}
```

For updating RBAC configuration after some changes jus run following command:

```
$ yii rbacc/update
```

Collector will read your config classes and update RBAC data using your current AuthManager - PhpManager or DbManager

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Recently: every ~178 days

Total

9

Last Release

2961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b8c6adf1c1a9a603f5b2ae278db4d4f4abc3f1d31c1ed49ff26fb181b6bbb81?d=identicon)[agilov](/maintainers/agilov)

---

Top Contributors

[![agilov](https://avatars.githubusercontent.com/u/825624?v=4)](https://github.com/agilov "agilov (13 commits)")

---

Tags

rbacyii2romi45

### Embed Badge

![Health badge](/badges/romi45-yii2-rbac-collector/health.svg)

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

###  Alternatives

[budyaga/yii2-users

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

409.1k](/packages/budyaga-yii2-users)[letyii/yii2-rbac-cached

Cached for yii2 RBAC

112.2k](/packages/letyii-yii2-rbac-cached)

PHPackages © 2026

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