Hi Chris,
It's (almost) same to what I do also - I don't think you might need
something more elegant.

// Get application stack configuration
$configuration = include 'config/application.config.php';

//loads local config if available
if(is_readable('config/application.local.php')) {
    $localConfig = include 'config/application.local.php';
    $configuration = array_merge_recursive($configuration, $localConfig);
}

Matus

On Wed, Oct 24, 2012 at 9:26 AM, Christian Ebert <[email protected]>wrote:

> 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
>
>

Reply via email to