1. Go to this page and download the library: Download binn/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/ */
'auth' => array(
'userClass' => Yii::$app->user->identityClass, // the name of the user model class.
'userIdColumn' => 'id', // the name of the user id column.
'userNameColumn' => 'name', // the name of the user name column.
'applicationControllers' => [], // the path to controllers files that will be using for generates permissions.
'admin' => [], // users with full access to module.
'accessFilterBehavior' => [], Configuration for custom access filter.
),
if (Yii::$app->user->can('itemName')) // itemName = name of the operation
{
// access is allowed.
}