This document will guide you through the process of installing Yii2-rbac using composer. Installation is a quick and easy three-step process.
NOTE: Before we start make sure that you have properly configured db application component.
Add Yii2-rbac to the require section of your composer.json file:
{
"require": {
"dektrium/yii2-rbac": "dev-master"
}
}
And run following command to download extension using composer:
$ php composer.phar update
Add following lines to your main configuration file:
...
'modules' => [
...
'rbac' => [
'class' => 'dektrium\rbac\Module',
],
...
],
...
After you downloaded and configured Yii2-rbac, the last thing you need to do is updating your database schema by applying the migrations:
$ php yii migrate/up --migrationPath=@yii/rbac/migrations