Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multiple Apps with a single fuelphp core
  • Hello,

    i want to run several sites, using a single fuelphp installation.
    For this, i've created a structure as described here
    https://fuelphp.com/forums/discussion/1032/folder-structure-for-multiple-apps

    is this ( the post is a bit old ) still correct?

    if yes: is there a way, to create a single config file, which is loaded automatically by every app?

    thx!



  • You can make it as complex as you really want. This is the structure we use for our commercial apps: https://bin.fuelphp.com/snippet/view/OM

    It requires:
    • changes to the index.php of your apps (APPPATH, COREPATH, VENDORPATH and PKGPATH)
    • adding the global modules and packages paths to the apps config.php (always_load, profile paths, clean_paths)
    Since we only deploy using our own VM Linux image, we use symlinks in our RPM packages and our theme installer (part of the admin section) to make globally installed themes available in the apps public folder, which is better and faster than copying files.

    As for configs, in our cache every app has it's own config, simply because I wouldn't immediately know what config I would like to share on a global level.

    But if you have a use case, the simplest is to create a config folder at global level to store your config files in, and either symlink them in the app (allows for full access, including writing to the config file), or handle it in the apps config file:

    $global = require_once(__DIR__.'/../../../config/somefile.php');

    return array_merge($global, array(
       // your local config, or global overrides
    ));
  • Hi Harro,

    thx for the replay and the structure. I will try that!

  • You're welcome.

    We have chosen for this architecture because our apps interact with oneanother via a generic REST api. This allows us to either install 30+ apps on a single VM on a laptop for demo purposes, or scale out to a single app per VM, with hunderds of VM's, where similar apps are loadbalanced and layers are multi-tiered and separated by application firewalls, without changes to the app or the server setup.

Howdy, Stranger!

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

In this Discussion