PHP code example of mg-code / yii2-auth

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

    

mg-code / yii2-auth example snippets


return [
    'components' => [
        ....
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
            'defaultRoles' => ['public', 'authenticated'],
        ]
    ],
    'as access' => [
        'class' => 'mgcode\auth\components\AccessControl',
        'app' => 'backend',
        'allowActions' => [
            'site/error'
        ],
        'disallowActions' => [
            'disabled/action',
        ]
    ],
];