PHP code example of marqu3s / yii2-rbac-plus

1. Go to this page and download the library: Download marqu3s/yii2-rbac-plus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marqu3s / yii2-rbac-plus example snippets


'components' => [
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
],
'modules' => [
    'rbac' =>  [
        'class' => 'marqu3s\rbacplus\Module'
    ]
]

'modules' => [
    'rbac' =>  [
        'class' => 'marqu3s\rbacplus\Module',
        'userModelClassName' => null,
        'userModelIdField' => 'id',
        'userModelLoginField' => 'username',
        'userModelLoginFieldLabel' => null,
        'userModelExtraDataColumls' => null,
        'beforeCreateController' => null,
        'beforeAction' => null
    ]
],

'userModelExtraDataColumls' => [
    [
        'attributes' => 'created_at',
        'format' => 'datetime',
    ]
],

'beforeCreateController' => function($route) {
    /**
    *@var string $route The route consisting of module, controller and action IDs.
    */
}

'beforeAction' => function($action) {
    /**
    *@var yii\base\Action $action the action to be executed.
    */
}
shell
php yii migrate/up --migrationPath=@yii/rbac/migrations