The Module Manager is responsible for iterating over an array of module names and triggering a sequence of instantiation of module classes, initialization, and merge configuration.
By default, one module is provided with the JiNexus Framework, named "Application". It provides a controller to handle the "home" page of the application, the layout template, and templates for 404 and error pages, and its own configuration.
Module is loaded through the help of Module Manager. You can create another module to separate other controllers and layout templates.
Lets create a new module name "Blog". Below is the updated Application Structure of my project:
Next is you have to modify the Module.php and add the following methods. Your Module.php should look like this:
Next is we have to map our new module using PSR-4 auto loading. Your composer.json should look like this:
Lastly is we have to enable our new module by adding it to our config/modules.config.php.
Your modules.config.php should look like this:
In modules.config.php all modules are loaded from top to bottom. And each module configuration are merge to one whole configuration that includes routes, view_manager, etc. So if there are instances that a similar keys exist in each of your module configuration, please be aware that the latest module may overwrite the previous modules configuration.
If you found a typo or error, please help us improve this document. Contact Us