PHP code example of heimo / yii2-rbac

1. Go to this page and download the library: Download heimo/yii2-rbac 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/ */

    

heimo / yii2-rbac example snippets


composer 

    'components' => [
        'authManager' => [
            'class' => 'heimo\rbac\components\DbManager', //配置文件
        ],
    ],

    'as access' => [
        'class' => 'heimo\rbac\components\AccessControl',
        'allowActions' => [//允许访问的节点,可自行添加
            'login/*',
            'logout/*',
            'callback/*',
        ]
    ],

yii migrate --migrationPath=@vendor/heimo/yii2-rbac/migrations

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