Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Modules & config
  • I'm currently working on module based application and came across some problem.
    Is there any way that one module can access config of another module ?

    Tried Config::load() then Config::get()

    and Module::load()

    None of these will access the config file while it is in module directory.
    I can get configs when i move them to main config directory, but I want to fully separate module and its config from rest of the app.

    Any suggestions ?


  • HarroHarro
    Accepted Answer
    Yes, you can:

    Config::load('module::file');

    I'm not sure the module has to be loaded for this, but you can test that.

    but any hard-coded cross-module access is considered bad practice, as it violates loose coupling of modules, and blocks easy re-usability of modules.

    It is better to make sure modules are self-contained, and only have an interface with the outside world (= anything outside the module) through HMVC calls.

  • This works like a charm, thank you!

    PS. What i'm trying to get is self configuring app, following one simple convention. One of the modules "manager" is looking for all uploaded modules and building all menu and available actions out of info stored on each module config files.

    May rethink the idea to use HMVC calls, but for now I need to move whole thing from old Kohana core to Fuel.
  • Ok. Good luck with your migration.

Howdy, Stranger!

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

In this Discussion