list currently logged in user


Is there any user created yii2 module that can list currently online user or currently logged in user?

If there is no such module, is there any guide on how to list those user myself?


Create a new field in your user table, you can name that as "login_status" and update the status frequently based on active session of the user.

Then it is very simple you can retrieve the users based on login_status from your user table.




  1. As well change the status when the user logs out from the application.

  2. May be a cron for auto updating the login status if the session has been timed out when the user did not log out properly.