[Solved] Where to set Session Variables

I need to set $session[‘client_name’]= ‘Company Name of logged user’ at the time of: -

  1. 1st time login (with remember me on)

  2. Upon subsequent access, as no login page displayed every time, as authendication is done from cookie.

Please guide me, Where should i write the code? as site controller’s actionLogin is not called everytime i access the application.

I suggest you to write a simple class and put it in bootstrap process (yii2 application bootstrap, not the css framework)

Here you can at first verify if the user is logged in, and eventually get the data and set them in session if necessary.

Done,

Actually i have extended the Yii/web/user class, and saved session variable in afterLogin event.