How do I implement automatic user Yii::$app->user->logout through Yii::$app->user->logout so that it Yii::$app->user->logout after 15 minutes in cases when the user is not active,

    1 answer 1

    Go to config / web.php and find the array with the user key.

    Add the value of 'authTimeout' => 120

    In the end, it should look something like this:

     'user' => [ 'identityClass' => 'app\components\UserIdentity', 'enableAutoLogin' => true, 'loginUrl' => ['login/index'], 'authTimeout' => '120', //секунды ], 
    • enableAutoLogin and loginUrl may look different and do not play a special role in the process :) - MasterAlex
    • I wrote about what should look like. So you can clearly see where you need to write the parameter authTimeout. And he is the main answer to this question - Urmuz Tagizade