How to use Yii as external class on another application

I think Yii have a full features to help us develop web application faster. I’m enjoy write an application using Yii Framework.

I thinking about using Yii as external class on another application for example use it on open source applications like Wordpress, Drupal, or Oscommerce. The shortest way to do this in my mind is change the instance in index.php from CWebApplication class to CApplication class so we will not use some component like CController and CAction. But I don’t know how about the directory structure will be use for case like this.

What do you think about this, what is the best way to use Yii Framework as external class in another application? Should I create a new ticket to add new feature to Yii Framework?

You only need to create the application instance without calling run() method. That’s all you need if you want to use Yii in an existing project.

i guess you need the setPathOfAlias function~

in your protected/config/main.php like this:

Yii::setPathOfAlias('other_app', $other_app_path);

and then in your current application file,

you can use:


Thanks for the answer. I hope there is a console command to generate Yii directory for running it as external class like CConsoleApplication but it doesn’t generate directories that doesn’t need by CApplication.

I will try that way above. Thanks…