Implementing a ZF2 development mode

One feature that piqued my interested in the Apigility skeleton application was development mode. From the README:

Once you have the basic installation, you need to put it in development mode:

cd path/to/install
php public/index.php development enable # put the skeleton in development mode


Behind the scenes, this command runs an action in DevelopmentModeController which copies config/development.config.php.dist to config/development.config.php. Then there is some code in public/index.php that ensures that this file is loaded.

The config/development.config.php file then enables you to have ModuleManager specific configuration for development. This means that you can turn off caching, load modules that you don’t want in production and also load autoload development config files when developing that are not applied in production.

This is such a useful ability, that I want it for my ZF2 projects, so I’ve extracted the core functionality into a module called NFDevelopmentMode.

Hopefully the README is clear enough and thank you to the Apigility team for doing the actual work for this!

Update: The official version is now on the ZF Campus GitHub

2 thoughts on “Implementing a ZF2 development mode

  1. Nice post. Tks
    But a curiosity …
    why link the development mode on the command line rather than on the application environment?
    Perhaps because it’s impossiblile detecting the environment in PHP CLI scripts?

    Sorry for my english.

Comments are closed.