PHPackages                             itstructure/yii2-rbac-module - 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. itstructure/yii2-rbac-module

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

itstructure/yii2-rbac-module
============================

Module to manage roles and permissions for the Yii2 Framework.

3.0.6(6mo ago)2347[1 issues](https://github.com/itstructure/yii2-rbac-module/issues)MITPHPPHP &gt;=7.1.0

Since May 13Pushed 6mo agoCompare

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

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

Yii2 RBAC module
================

[](#yii2-rbac-module)

Introduction
------------

[](#introduction)

[![Latest Stable Version](https://camo.githubusercontent.com/364a6869c0141e33d13b5eb897daf22e9ae3f14dfeed0c1795a726cde752329a/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f796969322d726261632d6d6f64756c652f762f737461626c65)](https://packagist.org/packages/itstructure/yii2-rbac-module)[![Latest Unstable Version](https://camo.githubusercontent.com/215ca197ed23a18bc24d8a98f3e1a2db0a0314da60f057b31abfb01476ebba65/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f796969322d726261632d6d6f64756c652f762f756e737461626c65)](https://packagist.org/packages/itstructure/yii2-rbac-module)[![License](https://camo.githubusercontent.com/0593bd2a05c3a12cf6de242f76e11c8b5ea0968737eb50125341da02b62725fa/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f796969322d726261632d6d6f64756c652f6c6963656e7365)](https://packagist.org/packages/itstructure/yii2-rbac-module)[![Total Downloads](https://camo.githubusercontent.com/da897fdfba344f522278a25263b99ed332eb64b6f59f3c0e0e72ce2edecca7c8/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f796969322d726261632d6d6f64756c652f646f776e6c6f616473)](https://packagist.org/packages/itstructure/yii2-rbac-module)[![Build Status](https://camo.githubusercontent.com/9874cf77d1a35f05737127c47d34e8b0258e8bb92e17c9b5af3d78a8c8c9e217/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69747374727563747572652f796969322d726261632d6d6f64756c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/924a27b91b0b2a5ff5f22e2f299d106bcbce76c04a19b7ed416831201e9383ff/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69747374727563747572652f796969322d726261632d6d6f64756c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itstructure/yii2-rbac-module/?branch=master)

**RBAC module** - Module for the Yii2 v2.0.x framework, which provides management with the next data:

- Roles
- Permissions
- Assign roles for users(profiles)

[![RBAC extension structure](https://github.com/itstructure/yii2-rbac-module/raw/master/yii2_rbac_structure_en.jpg)](https://github.com/itstructure/yii2-rbac-module/blob/master/yii2_rbac_structure_en.jpg)

Dependencies
------------

[](#dependencies)

- php &gt;= 7.1
- composer 2
- MySql &gt;= 5.5 or MariaDB &gt;= 10.1

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

[](#installation)

### General from remote repository

[](#general-from-remote-repository)

Via composer:

`composer require itstructure/yii2-rbac-module "~3.0.6"`

### If you are testing this package from local server directory

[](#if-you-are-testing-this-package-from-local-server-directory)

In application `composer.json` file set the repository, like in example:

```
"repositories": [
    {
        "type": "path",
        "url": "../yii2-rbac-module",
        "options": {
            "symlink": true
        }
    }
],
```

Here,

**yii2-rbac-module** - directory name, which has the same directory level like application and contains yii2 rbac module.

Then run command:

`composer require itstructure/yii2-rbac-module:dev-master --prefer-source`

### Addition components

[](#addition-components)

In accordance with the [documentation for Yii2](http://www.yiiframework.com/doc-2.0/guide-security-authorization.html), set **authManager** for application:

```
'components' => [
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
    // ...
],
```

In accordance with the [documentation for Yii2](http://www.yiiframework.com/doc-2.0/guide-security-authorization.html), run command:

```
yii migrate --migrationPath=@yii/rbac/migrations
```

Usage
-----

[](#usage)

### Main properties

[](#main-properties)

- The **name** of module: `rbac`
- The **namespace** for used classes: `Itstructure\RbacModule`.
- The **alias** to access in to module root directory: `@rbac`.
- **There is not a layout !** It's taken from application layout **main** by default **or how it is configured**. You cat set `layout` attribute in module by custom.
- **View** component is taken by default from the framework like **yii\\web\\View**. You cat set **view** component in module by custom.

### Application config

[](#application-config)

Base application config must be like in example below:

```
use Itstructure\RbacModule\Module;
use Itstructure\RbacModule\controllers\{RoleController, PermissionController, ProfileController};
```

```
'modules' => [
    'rbac' => [
        'class' => Module::class,
        'controllerMap' => [
            'roles' => RoleController::class,
            'permissions' => PermissionController::class,
            'profiles' => ProfileController::class,
        ],
    ],
],
```

### Useful module attributes

[](#useful-module-attributes)

You can set the following attributes in a module config:

- `loginUrl` - set url to be redirected if you are not authorized.
- `accessRoles` - The roles of users who are allowed access to work with this package.
- `urlPrefix` - Url prefix for redirect and view links (Default is empty).
- `urlPrefixNeighbor` - Url prefix for redirect and view links of neighbor entity (Default is empty).

License
-------

[](#license)

Copyright © 2018-2025 Andrey Girnik .

Licensed under the [MIT license](http://opensource.org/licenses/MIT). See LICENSE.txt for details.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance56

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

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

Recently: every ~477 days

Total

10

Last Release

205d ago

Major Versions

1.1.0 → 2.0.02018-08-01

2.0.0 → 3.0.02018-08-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31563329?v=4)[Andrey Girnik](/maintainers/itstructure)[@itstructure](https://github.com/itstructure)

---

Top Contributors

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

---

Tags

modulerbacyii2yii2-frameworkyii2-rbacrbacyii2moduleyii 2

### Embed Badge

![Health badge](/badges/itstructure-yii2-rbac-module/health.svg)

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

###  Alternatives

[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

298275.5k14](/packages/2amigos-yii2-usuario)[githubjeka/yii2-gui-rbac

Yii 2 RBAC management GUI interface

8244.9k1](/packages/githubjeka-yii2-gui-rbac)[vova07/yii2-rbac-module

The RBAC module for Yii framework.

191.2k2](/packages/vova07-yii2-rbac-module)[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)[liujx/yii2-app-advanced

Yii2 ace-admin RBAC management background

1301.4k](/packages/liujx-yii2-app-advanced)[lowbase/yii2-user

Yii2 user module

131.5k2](/packages/lowbase-yii2-user)

PHPackages © 2026

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