What Is Formal Approach To Share Global Variable?

Hi, I want to know, what is the formal approach to share global status throughout the whole web site?

I tried session variable, ex:

Yii::app()->session[‘var’] = ‘value’;

However, in components folder, the session variables seem to be unavailable. What should I do? I appreciate your help. Thanks!

Maybe config params array?

Yii::app()->params[‘globalVar’]

Yes, it works. Thank you!