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

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

arogachev/yii2-rbac
===================

RBAC management for Yii 2 framework

0.1.0(10y ago)41.3k4[1 issues](https://github.com/arogachev/yii2-rbac/issues)BSD-3-ClausePHP

Since Dec 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/arogachev/yii2-rbac)[ Packagist](https://packagist.org/packages/arogachev/yii2-rbac)[ Docs](https://github.com/arogachev/yii2-rbac)[ RSS](/packages/arogachev-yii2-rbac/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Yii 2 RBAC
==========

[](#yii-2-rbac)

RBAC management for Yii 2 framework.

The main purpose of this extension is to provide management of RBAC roles, permissions, rules and relations between them through configuration arrays.

[![Latest Stable Version](https://camo.githubusercontent.com/b59d2893447b6f991465ad736e1347a6e7727f1c7c5d0a02b20684c6420b341f/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d726261632f762f737461626c65)](https://packagist.org/packages/arogachev/yii2-rbac)[![Total Downloads](https://camo.githubusercontent.com/3f39e6afb5e6fe17feb4a2a29c0e19efd7150e6d14dccf7fa0b372d83abf5662/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d726261632f646f776e6c6f616473)](https://packagist.org/packages/arogachev/yii2-rbac)[![Latest Unstable Version](https://camo.githubusercontent.com/ab906d66b825fd447ca2055ad74560b7d4e66a57821b78bab107183fa4570ced/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d726261632f762f756e737461626c65)](https://packagist.org/packages/arogachev/yii2-rbac)[![License](https://camo.githubusercontent.com/3b63c11d272bbafd02cc46448dc8f40cb5631f1db356019717f3a7887727285a/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d726261632f6c6963656e7365)](https://packagist.org/packages/arogachev/yii2-rbac)

- [Installation](#installation)
- [Features](#features)
- [Configuration arrays](#configuration-arrays)
- [Data synchronization](#data-synchronization)
- [Rules](#rules)
- [GUI](#gui)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist arogachev/yii2-rbac

```

or add

```
"arogachev/yii2-rbac": "*"

```

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

Features
--------

[](#features)

- Adding new roles and permissions with descriptions
- Updating permissions names, descriptions and rules
- Deleting permissions, rules
- Updating roles descriptions
- Assigning rules to permissions
- Assigning permissions to roles

Configuration arrays
--------------------

[](#configuration-arrays)

First of all, you need to create three files for storing RBAC data:

- `roles.php`. Used for storing roles.
- `permissions.php`. Used for storing permissions and relations between permissions and rules.
- `children.php`. Used for storing relations between roles and permissions.

You can place it anywhere you want. If you are using advanced application, it's recommended to place them in `common/rbac/data` folder.

Example of `roles.php` content:

```
