Hi,
I want to enable certain modules - e.g. developer tools - solely on the
local development environment. Currently I am loading my modules using
application.config.php in index.php as shown in the skeleton application.
Which is the recommended way to add certain modules for the local
(development) environment only? I already tried to add them in local.php,
but that does obviously not work. Is there any dedicated mechanism to
provide them more or less automatically similar to global.php/local.php
logic with the config settings? I came up with the following solution in
index.php but would love to see a more elegant solution:
$appConfig = require 'config/application.config.php';
if(file_exists('config/autoload/local.php')){
$localAppConfig = require 'config/autoload/local.php';
if(is_array($localAppConfig) AND
array_key_exists('modules',$localAppConfig)){
// specific modules for development
environment are loaded before general available modules are loaded
$appConfig['modules'] =
array_merge($localAppConfig['modules'],$appConfig['modules']);
}
}
// Run the application!
Zend\Mvc\Application::init($appConfig)->run();
Best Regards
Christian