Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Why models and controllers are in a separate forder?
  • Is this done in favor of autoloader speed? I think it really reduces the comfort, but then if all the classes in classes folder autoload by default, maybe it is good to lose some comfort and gain some clarity instead.
  • Could you try to rephrase that? I have no clue what you're trying to ask. But to get an answer you could try reading this blogpost.
  • I was trying to ask whether there was any particular reason for creating folder 'classes' and putting 'models' and 'controllers' there? Other frameworks, like Yii, Codeigniter, CakePHP as far as I remember have 'views','models' and 'controllers' folders placed in the application root folder. Without a subfolder named 'classes'. So I was trying to ask if there was any special reason for the 'classes' folder?
  • Actually: for transparancy. All classes are always autoloaded and the autoloader is very much optimized. The namespace links to either the core or to a package an the global namespace (non namespaced) is tied to App. From there the underscores are translated into slashes and thus the class is found in either classes/controller or classes/model in your examples. All the other ways would be far less transparent and force multiple filesystem checks. Read the blogpost I mentioned above for more info on the how & why of our autoloader.
  • Everything is a class in fuel. I actually found this pattern helpful because it takes the guess work out of loading everything and knowing where everything is sitting in the file system. The autoloader takes care of everything. You load models the same way you load the HTML "Helpers". It's convenient.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion