Does CodeIgniter support Namespace?
Just a simple psr-4 autoloading and you are done.
In the config/config.php load composer using
$config['composer_autoload'] = FCPATH.'vendor/autoload.php';
In the root directory run composer install
In the generated composer.json add following lines for psr4 autoloading.
"autoload": {
"psr-4": {
"App\\": "application/"
}
},
App would be your namespace in this case.
Example: suppose you have a class Service in libraries folder. You can namespace it with:
Use it in Welcome controller class: