zend framework2 - Is there any way to override ZF2 application.config.php directives locally? -


i'm working on zf2 project , public/index.php file follows:

<?php chdir(dirname(__dir__)); require 'init_autoloader.php'; zend\mvc\application::init(require 'config/application.config.php')->run(); 

application initialize process starts using application.config.php , know zf2 provides nice way override module configurations locally via filenames modulename.local.php not application.config.php file.

for example, in application.config.php have module_listener_options key follows:

return array(     'modules' => array(     // ...     ),      'module_listener_options' => array(         'module_paths' => array(          // ...          ),      'config_glob_paths' => array(         'config/autoload/{,*.}{global,local}.php',      ),       'config_cache_enabled' => true,      'config_cache_key' => 'configuration_cache',      'cache_dir' => __dir__ . '/../data/cache' // ... ) 

so want disable config caching locally while working on development environment want turn on in production environment without need post-deployment tricks (like writing custom git-hook / bash script etc..).

also have application_environment $_env variable on servers (dev, prod, test) don't know best approach achieve in zf2.

i found stephen rees-carter's article, yes workarounds problem want learn there other / more elegant solutions doesn't depends on composer.

you test environment variable in app config , set caching accordingly, eg.,

<?php // application.config.php $env = getenv('application_environment'); $configcacheenabled = ($env == 'production');  return array(     //..      'config_cache_enabled' => $configcacheenabled,      //.. ); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -