library twm-dev
ZF2 module to override settings with an additional config file when on development server.
thewebmen/twm-dev
ZF2 module to override settings with an additional config file when on development server.
- Wednesday, August 14, 2013
- by rskuipers
- Repository
- 7 Watchers
- 0 Stars
- 6 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
TwmDev
ZF2 module to override settings with an additional config file when on development server., (*1)
Features
- Defines a DEV constant to check whether or not you're on development
- Allows you to have a development config file which will override every other setting
Installation
-
First we have to make sure your development server is setup properly.
Open /etc/apache2/envvars on your development server and add the following line to the bottom of the file:, (*2)
export APACHE_ARGUMENTS="-D dev"
-
Restart your apache., (*3)
-
Add the following line to your composer file:, (*4)
"require": {
"thewebmen/twm-dev": "~1.0.0"
}
Or use the following command:, (*5)
php composer.phar require thewebmen/twm-dev ~1.0.0
-
Add the module to the end of your array in application.config.php, (*6)
return array(
'modules' => array(
/*...*/
'TwmDev',
),
);
It is very important this module is at the end, for it to properly override all settings with your development settings., (*7)
Usage
Create a config/autoload/dev.php and put any settings in there that should be used in development (like different database/credentials or disable caching)., (*8)
Because PHP CLI has no idea of the apache or httpd envvars it won't automatically recognize you're on a development server. For this I created a flag --dev which you can add when using the ZF2 CLI.
That flag will tell TwmDev you're on development and load the development config., (*9)