<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bitmannl / codeigniter-modular-extensions example snippets
class Xyz extends MX_Controller
{
$autoload = array(
'helper' => array('url', 'form'),
'libraries' => array('email'),
);
}
The Modules::$locations array may be set in the application/config.php file. ie:
:::php
$config['modules_locations'] = array(
APPPATH.'modules/' => '../modules/',
);
Modules::run() output is buffered, so any data returned or output directly from the controller is caught and
returned to the caller. In particular, $this->load->view() can be used as you would in a normal controller, without the need for return.
Controllers can be loaded as class variables of other controllers using $this->load->module('module/controller');
or simply $this->load->module('module'); if the controller name matches the module name.
Any loaded module controller can then be used like a library, ie: $this->controller->method(), but it has access to its own models and libraries independently from the caller.
All module controllers are accessible from the URL via module/controller/method or simply module/method if the module and controller names match.
If you add the _remap() method to your controllers you can prevent unwanted access to them from the URL and redirect or flag an error as you like.
### Notes:
To use HMVC functionality, such as Modules::run(), controllers must extend the MX_Controller class.
To use Modular Separation only, without HMVC, controllers will extend the CodeIgniter Controller class.
You must use PHP5 style constructors in your controllers. ie:
:::php
class Xyz extends MX_Controller
{
function __construct()
{
parent::__construct();
}
}
Constructors are not ature allows you to freely extend your controllers, models and libraries from
application/core or application/libraries base classes without the need to specifically include or
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.