ZF2 Deploy Module is a Zend Framework 2 provides tools for deploying ZF2 module into a ZendSkeletonApplication to display / tests module's views

v1.0 2013-10-08 18:22 UTC


Build Status Latest Stable Version Total Downloads

NOTE : If you want to contribute don't hesitate, I'll review any PR.


ZF2 Deploy Module provides tools for deploying ZF2 modules into a ZendSkeletonApplication to display / tests module's views. It is useful for ZF2 modules developers, in order to render modules views (for humans, selenium...).

The benefit of this tool is that it does not change the module to deploy (no moving / changing / adding files), it manages the autoloading, composer (install / update), and adding the module(s) in the application configuration.


If you wish to contribute to ZF2 Deploy Module, please read both the file.



Main Setup

By cloning project

  1. Clone this project into your ./vendor/ directory.

With composer

  1. Add this project in your composer.json:

    "require_dev": {
        "neilime/zf2-deploy-module": "1.*"


    "require": {
        "neilime/zf2-deploy-module": "1.*"
  2. Now tell composer to download ZF2 Deploy Module by running the command:

    $ php composer.phar update

How to use ZF2 Deploy Module

ZF2 Deploy Module provides console tools.


php ./vendor/bin/deploy_module.php [args]


--help|-h                   Get usage message
--module|-m [ <string> ] 	Module path to deploy; if none provided, assumes current directory
--dir|-d [ <string> ]    	Directory path where to deploy the module (ex: apache/www/my-module), the directory could be created if needed
--modules|-a [ <string> ]	(optionnal) Additionnal module namespaces (comma separated) to be used in the application
--zapp|-z [ <string> ]   	(optionnal) ZendSkeletonApplication file path, allows locale or remote directory, allows archive (Phar, Rar, Zip) depending on PHP installed libraries
--composer|-c [ <string> ]  (optionnal) Composer.phar file path, allows locale or remote directory
--overwrite|-w 				Whether or not to overwrite existing deployed ZendSkeletonApplication
--verbose|-v 				Whether or not to display execution trace


Deploy a module to run it with EasyPhp (windows)

This exemple expects :

  • EasyPhp & PHP is installed on windows
  • A virtual host named "" redirect to DocumentRoot "C:\Program Files\EasyPHP-DevServer\data\localweb\TestModule\public"
  1. Install ZF2 Deploy Module into the your module project as explain above

  2. Deploy module into EasyPhp "\TestModule"

    cd path\to\your\module\directory
    php ./vendor/bin/deploy_module.php -d "C:\Program Files\EasyPHP-DevServer\data\localweb\TestModule" -v
  3. Display it in your browser Go to

Deploy a module for Selenium tests with ""

  1. Edit your .travis.yml

Update composer

  • composer self-update

Install project

  • composer install --dev -o #deploy module
  • mkdir ../deploy
  • php ./vendor/bin/deploy_module.php -d ../deploy -v

Install php packages

  • "sudo apt-get update > /dev/null"
  • "sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-intl"

Create VirtualHost

  • sudo sed -i -e "s,/var/www,$(pwd)/../deploy/public,g" /etc/apache2/sites-available/default
  • sudo sed -i -e "/DocumentRoot/i\ServerName" /etc/apache2/sites-available/default
  • echo "" | sudo tee -a /etc/hosts
  • "sudo /etc/init.d/apache2 restart" #Run selenium
  • "sh -e /etc/init.d/xvfb start"
  • "export DISPLAY=:99.0"
  • "wget"
  • "java -jar selenium-server-standalone-2.25.0.jar > /dev/null 2>&1 &"
  • "sleep 30"
  1. Run the build