How use own object in controller

I have object - instance of some class.

$obj = new SomeClass();

How I can use this object in all extended class in Yii?

Put your class in /protected/components folder and… use it where do you prefer =).

or by adding your class details to component section in config you can access it everywhere without creating the object every time.

// Config






// Accessing


// You have to define init() method inside your class.And it should be there in components folder.