Reputation: 16288
I want to load ghislainf/zf2-whoops only on development environments, but it says I have to load it first (meaning in application.config.php
).
Is there a way to load development.config.php
modules first?
UPDATE:
I'm loading the env variables using abacaphiliac/zend-phpdotenv, meaning the env variables are not loaded yet by the time the application.config.php
is being processed. For this reason I can't use dynamic loading based on environment. That's the reason I was looking to load development modules first.
Upvotes: 0
Views: 230
Reputation: 44422
You can easily setup different configuration files for different environments. So one configuration for development and a different one for production.
This is very well described in the Zend Framework documentation chapter called Advanced Configuration Tricks and more specifically here in Environment-specific system configuration:
The trick they use is to set the APP_ENV
global variable and set it to either production
or development
.
<?php
$env = getenv('APP_ENV') ?: 'production';
// Use the $env value to determine which modules to load
$modules = array(
'Application',
);
if ($env == 'development') {
$modules[] = 'ZendDeveloperTools';
}
When using this solution you can in each config load the modules that you need in the order that you need them.
Upvotes: 1