Autoloading of php classes


In the main.php config file you can configure under ‘import’ => … which classes you want to autoload.







Here it loadas all classes in the folder models and components. whats the best solution withouth to write all subfolders etc here, to load also the classes in the subfolders in models etc.?

thanks for help.

If you have placed models in subfolders of models and you do not want to write all those subfolders there, then I believe that the best way is to register your own autoload function for those folders. In this way you make sure Yii wont fail to load those…

Also check out the discussion of this issue: