Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Help with modules
  • I am building an app that have a few modules. One of them consists of a few ones itself.
    I am not sure how it can be done with Fuel, and how should I manage them properly (requests). Consider the following structure: modules
    ......../classes
    ................/controller
    ................/
    ......../activities
    ................/activity
    ......................../classes
    ................................/controller
    ................/ While a path to the activities-modules can be added,
    I want to have a kind of url and directory prefix to the activities (/activities/activity) without fearing module names collisions in future.
  • Whether in your app, a module or a package, classes have to go in 'classes'. There is no exception to that rule, that is how the autoloader works. I'm not sure what you want to achieve functionally. If you can describe that, maybe we can suggest a structure.
  • I want to be able to install and uninstall these modules easily from a backend panel, and maybe each one will have a config file (module version, description etc).
  • You can do that with the standard modules, I don't see a reason why you would need modules in modules. No matter what your construction, you'll have the problem of collision that you have to manage. For standard modules, that is the name of the module (which is equal to the namespace). This doesn't change if you move the module elsewhere.
  • It's neat. I want the 3rd-party classes of each "activity" to go into 'module/activities/activity/classes', and not confuse activities with standard modules. How can I manage that?
  • You can't. It's a construction not supported by the autoloader. The autoloader only loads classes inside the classes folder, and the 'classes' folder has to be a sub-folder of your module folder. Inside your classes folder you can do as crazy as you want to, with any mix of namespace and class names. For example, a file called module/classes/activities/activity/something.php can contain a class called "Activities_Activity_Something" in the namespace "Module", or "Something" in the namespace "Module\Activities\Activity" or anything in between.

Howdy, Stranger!

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

In this Discussion