How to get Yii instance outside Yii framework

Hi all,

How we can get Yii instance outside of Yii framework.


I use yii framework and another framework. for authentication user, I use Yii, but sometime when we on another framework, I need to determine authentication user using (Yii::app()->user->isGuest).

How can I get Yii instance on outside of Yii framework? Anyone have an Idea, please share…

Thanks in advance,

You can create an instance…

just don’t do run to the application

You can use Registry for that, for example Zend_Registry

as this:


you should NOT use


Hm… Completely from my mind, without testing (sorry, no time for that). You would do this just as you do this in your index.php application?

$config = dirname(__FILE__).'/protected/configuration/general.php';


But you have to test it yourself…


Never run into this section, but +1 for you for reminding this, as this proves again and again, how powerful Yii is, which makes my day just a little bit brighter! :]


Thank all master, your answer very useful for me :).

Will doing this create session variables? There are some frameworks which break when you mess around with the session before they load, even if they have different ids.

No. Yii is built on top of PHP’s built in session system. So session id will be the same. And it will not write to the session unless your code does it or when you login through Yii.

Hi am trying to implement this too, I have tried the below code

//Using Yii in third party libs


$config = '../Open_Accounts/protected/config/main.php';


However the result is a that it loads my default controller view


I think run() is being called by default am using Yii 1.1.12

I have got a solution, it seems that even without


Yii requires that you have a writable assets folder, so create one and have it writable