About yii modules

Hi All,

I would like to ask, if i have define modules in config/main, the system will pre load the the models in my modules too or will only load models when modules was call? If i have many modules will it cause slow loading?


As almost everything in Yii, it will only load when required

your app performance will stay the same

It will load when the url routes to it or when you use


If i was going to set in config/main.php ( method 1 )


		// uncomment the following to enable the Gii tool





	 	// If removed, Gii defaults to localhost only. Edit carefully to taste.







or method 2 ( in yii index.php )

$yii = Yii::createWebApplication($config);





May i know is that both performance is the same or which one will be more suitable?

the performance will stay the same, but method 1 is the best way for most cases

use the method 2 when you, for example, load the modules from the database or something like that

Thanks Gustavo, now i already understand. I will choose method 2 because i will need to pull modules from database. Thanks :)

Glad I could help

By the way, I would do it like this

//config file

return array(






class Bootstrap{

 static function begin( $event ){

  //this will execute when the application is read to run, before anything else

  //load from database and set the modules here



But my situation is i need to call database value to define what module should load, so i think i can use this method.