Lacking proper documentation, this guide is a stub copied from a [topic on the forum](http://www.yiiframework.com/forum/index.php/topic/49104-does-anyone-have-a-working-example-of-rbac/page__view__findpost__p__229098).
First af all, you modify your config (web.php or main.php),
```php
'authManager'=>[
'class'=>'app\components\PhpManager',// THIS IS YOUR AUTH MANAGER
'defaultRoles'=>['guest'],
],
```
Next, create the manager itself (app/components/PhpManager.php)
```php
<?php
namespaceapp\components;
useYii;
classPhpManagerextends\yii\rbac\PhpManager
{
publicfunctioninit()
{
if($this->authFile===NULL)
$this->authFile=Yii::getAlias('@app/data/rbac').'.php';// HERE GOES YOUR RBAC TREE FILE
parent::init();
if(!Yii::$app->user->isGuest){
$this->assign(Yii::$app->user->identity->id,Yii::$app->user->identity->role);// we suppose that user's role is stored in identity