In Yii 1 we had a UserIdentity class to store variables like id, firstName, lastName etc.

How can I store them in Yii 2?

I need to be able to say things like …

echo Yii::$app->user->fullName;

In Yii 1 I would store fullName in UserIdentity class but where do I put this in Yii 2?

Can you not use user your user identity model?


Kind of, I found the solution by the way and I will post it here …


To access the user model which you used to login with you do …


For example.