I am using CodeIgniter’s Application Packages feature to load in helpers, config and libraries over multiple applications. See https://www.codeigniter.com/user_guide/libraries/loader.html
Now the documentation suggests the following folders can be in the package:
config/
helpers/
language/
libraries/
models/
I also have a controller that I wish to share across multiple applications called MY_Controller, which all applications base controller will inherit from. However, adding in a controller folder does not seem to work. How can I share a controller across multiple applications?
I managed to solve this quite simply actually.
Still not as ideal as a proper CI functionality but basically I created the file MY_Controller.php in the /core folder of each application which contains the following:
The beauty of this is I don’t need to modify any core files provided by CI including index.php
The only disadvantage is if I have to (ever) rename or move the /shared application I’ll have to go and update each MY_Controller with the new path.