Step1 :
create a basic app, using composer or download a skeleton of yii2 basic template.
Step2:
Create a module using gii and put the little code shown in gii in your config/web.php.
Step3:
Change your module.php . Add these lines in the init method.
public function init()
{
parent::init();
Yii::$app->set(\'user\', [
\'class\' => \'yii\\web\\User\',
\'identityClass\' => \'app\\modules\\admin\\models\\User\',
\'enableAutoLogin\' => true,
\'loginUrl\' => [\'admin/default/login\'],
]);
Yii::$app->set(\'session\', [
\'class\' => \'yii\\web\\Session\',
\'name\' => \'_adminSessionId\',
]);
}
Here we are using user model in admin module to login to admin login.
Do your itsy bitsy changes for your login mechanism
Write your own access control and you are done.and change your urlmanager as needed.
This should solve your issue. If not you can send me your code snippet in the comments section. If I get some time off from building something more awesome (or don’t get kidnapped by the aliens), I will surely revert back to you.
Happy coding to you then !!!