Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Sharing model between apps.
I've an app, which is now in the point where it needs to be split out into 3 separate apps, but they all share common base of models and libraries. Some elements were refactored / created as a packages or modules but it would have more sense to separate them into separate apps.
The biggest question here is : how to share models between these 3 apps (they all work on same database scheme so it would have more sense to keep single copy of the model).
It was a bit easier in Kohana, as everything moved into system/models folder was available for other apps. The only idea I have is to create package / module containing all the models and use it between all the apps.
Any other suggestions / solutions to address this problem ?
There are several solutions possible.
If your apps are completely seperate (i.e. they have their own Fuel install, they should be able to run on different servers),
the simplest is to move those classes to a package, and install the package in all three, like you do with Fuel's own packages.
If your apps can share a single Fuel install because they run on the same server, you can easily do that by adapting the APPPATH, COREPATH and PACKAGEPATH constants in the public/index.php of each app (and in the oil script if you use it). In that case you only have one location for the package to maintain. Which would be similar to the way Kohana does it.
You can make it as complex as you want.
Our standard application setup has a dual layer approach, which has Fuel itself, a modules, packages and themes folder that is shared between applications, and it has an applications folder in which all applications are installed, which have the normal Fuel install (so including app, modules and packages), but without core and vendors, which are shared at the top level.
So we can just drop an app in, create a vhost for it, and it runs, using the shared components such as our webengine, an admin backend, etc.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion