Question

For the last couple of years, I've been developing a web application based on CodeIgniter. CI has served me well to date, but for the next generation of the software, I'm looking to move to PHP 5.3 and a more robust framework. I've watched FuelPHP since it showed up about a year ago and now that I'm getting to the point of starting the development of the next version of the application in earnest, I'm interested in giving FuelPHP a go.

My application relies on the use of multiple application directories. Essentially, there's a system application which has the system's core functionality, code that shouldn't be touched by admins because it'll be changed during updates. In addition, there's a user application directory where admins can extend and override system classes. This way, admins can customize the system without ever touching the system core (thus insulating them from losing their modifications when the system is updated). When a request comes in from the URL, I want the system to first check the user application directory. If it doesn't find the controller there, move on to the system application directory (where, in theory, it should find the file) and use that controller.

I don't want to make the mistake of approaching this problem from a CI or Kohana mindset, so what I'm wondering is what's the best way to go about doing this in FuelPHP? Since I don't have much experience with FuelPHP, I was hoping someone might be able to give me some pointers or shove me in the right direction.

Thanks!

Was it helpful?

Solution

FuelPHP has an 'app' folder that you can consider the core of your application. For smaller applications, it can also contain your application code.

For larger and/or more complex applications, use modules. A module has exactly the same folder structure as 'app', but lives in it's own namespace (= the module folder name). FuelPHP supports multiple module locations, so you could have a location that contains modules you share over different websites, and modules that are specific to your website.

Without any special routing, if the first segment in the URI is a module name, controllers from that module will be loaded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top