ZF2 Deploy Module
⚠️ This module is for Zend Framework 2, it is deprecated ⚠️, (*1)
, (*2)
NOTE : If you want to contribute don't hesitate, I'll review any PR., (*3)
Introduction
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...)., (*4)
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., (*5)
Contributing
If you wish to contribute to ZF2 Deploy Module, please read both the CONTRIBUTING.md file., (*6)
Requirements
Installation
Main Setup
By cloning project
- Clone this project into your
./vendor/
directory.
With composer
-
Add this project in your composer.json:, (*7)
"require_dev": {
"neilime/zf2-deploy-module": "1.*"
}
Or, (*8)
"require": {
"neilime/zf2-deploy-module": "1.*"
}
-
Now tell composer to download ZF2 Deploy Module by running the command:, (*9)
$ php composer.phar update
How to use ZF2 Deploy Module
ZF2 Deploy Module provides console tools., (*10)
Usage
php ./vendor/bin/deploy_module.php [args]
Arguments
--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
Exemple
Deploy a module to run it with EasyPhp (windows)
This exemple expects :
- EasyPhp & PHP is installed on windows
- A virtual host named "www.test-module.com" redirect to DocumentRoot "C:\Program Files\EasyPHP-DevServer\data\localweb\TestModule\public", (*11)
-
Install ZF2 Deploy Module into the your module project as explain above, (*12)
-
Deploy module into EasyPhp "\TestModule", (*13)
cd path\to\your\module\directory
php ./vendor/bin/deploy_module.php -d "C:\Program Files\EasyPHP-DevServer\data\localweb\TestModule" -v
-
Display it in your browser
Go to http://www.test-module.com, (*14)
Deploy a module for Selenium tests with "travis-ci.org"
- Edit your .travis.yml
```yml
before_install:
Update composer
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 test-selenium.dev" /etc/apache2/sites-available/default
- echo "127.0.0.1 test-selenium.dev" | 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 http://selenium.googlecode.com/files/selenium-server-standalone-2.25.0.jar"
- "java -jar selenium-server-standalone-2.25.0.jar > /dev/null 2>&1 &"
- "sleep 30"
```
- Run the build