Most web applications provide a way for users to log in or reset their forgotten passwords. In Yii2, we don't have this opportunity by default. For a
basic application template, Yii provides only two test users by default, which are statically described in the
User model. So, we have to implement special code to be able to enable user login from the database.
- Create a new application by using the Composer package manager, as described in the official guide at http://www.yiiframework.com/doc-2.0/guide-start-installation.html.
- In the component section of your config, add:
'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, ],
- Create a
Usertable. Create a migration by entering the following command: ...