Multiple Application Directories in FuelPHP

Over the past few years, I have been developing a Web application based on CodeIgniter. CI has proven itself to date, but for the next generation of software I am looking for a transition to PHP 5.3 and a more reliable structure. I watched FuelPHP since it appeared about a year ago, and now that I am starting to develop a new version of the application in earnest, I am interested in letting FuelPHP go.

My application relies on using multiple application directories. Essentially, there is a system application that has the functionality of a system kernel, a code that should not be affected by administrators, because it will be changed during updates. In addition, there is a user application directory where administrators can extend and override system classes. Thus, administrators can configure the system without affecting the system core (thereby isolating them from the loss of their modifications when updating the system). When the request comes from the URL, I want the system to first check the user application directory. If he does not find the controller there, go to the system application directory (where, theoretically, he should find the file) and use this controller.

I don’t want to make a mistake in approximating this problem from the thinking of CI or Kohana, so I wonder what is the best way to do this in FuelPHP? Since I don't have much experience with FuelPHP, I was hoping that someone could give me some pointers or shove me in the right direction.

Thanks!

+4
source share
1 answer

FuelPHP has an application folder in which you can view the core of your application. For small applications, it may also contain application code.

For larger and / or more complex applications, use modules. The module has exactly the same folder structure as the "application", but lives in it its own namespace (= module folder name). FuelPHP supports multiple module locations, so you may have a location that contains modules that you share on different sites, and modules specific to your site.

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

+8
source

Source: https://habr.com/ru/post/1387625/


All Articles