Download the PHP package bushbaby/zf2-module-phing-service without Composer
On this page you can find all versions of the php package bushbaby/zf2-module-phing-service. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bushbaby/zf2-module-phing-service
More information about bushbaby/zf2-module-phing-service
Files in bushbaby/zf2-module-phing-service
Package zf2-module-phing-service
Short Description Zend Framework 2 module for Phing, a PHP project build system or build tool based on Apache Ant.
License MIT
Homepage https://github.com/basz/zf2-module-phing-service
Informations about the package zf2-module-phing-service
BsbPhingService
Introduction
BsbPhingService is module for Zend Framework 2 that will enable you to execute phing build files from within ZF2 projects.
Requirements
- Zend Framework 2 >=2.0
- Phing >=2.4.13
- The ability to execute commandline programs from PHP via proc_open.
changelog
Installation
Using Composer
The recommended way to get a working copy of this project is to modify your composer.json in your project root. This will take care of dependencies.
"require":{
"bushbaby/zf2-module-phing-service":"~2.0",
},
and then update
cd /to/your/project/directory
./composer.phar update -v
Configuration
- Open
./configs/application.config.php
and add 'BsbPhingService' to the 'modules' parameter to register the module within your application. - Optionally copy
./vendor/bushbaby/zf2-module-phing-service/config/bsbphingservice.global.php.dist
to./config/autoload/bsbphingservice.global.php
to override some defaults.
How to use BsbPhingService
There is only one command to use which is $service->build($target, $phingOptions);
.
As of version 2.0.0 an instance of the Symfony Process component is returned when you call 'build'.
A third argument 'immediate' has been added to build which allows you retrieve a configured but unexecuted Process instance for whenever you need to do more advanced process management. Such as getting realtime feedback or asynchronously running the build.
See the official documentation of Symfony Process component.
Controller example
You can create an instance of the Service manually, however it is recommended to retrieve an configured instance from the ServiceLocator. The ServiceLocator is available in every controller so retrieval is trivial.
public function indexAction() {
$options = array('buildFile' => __DIR__ . '/../../../data/build-example.xml');
$buildResult = $this->getServiceLocator()->get('BsbPhingService')->build('show-defaults dist', $options);
if ($buildResult->getExitCode() > 0) {
// problem
echo $buildResult->getCommandline();
echo $buildResult->getErrorOutput();
} else {
// yeah
echo $buildResult->getOutput();
}
$view = new ViewModel(array('process'=>$buildResult));
return $view;
}
To get a quick taste you can enable the defined route in module.conf.php and point your
browser at http://yourhost/phingservice
to get an working example.
All versions of zf2-module-phing-service with dependencies
phing/phing Version ~2.4,>=2.4.13
zendframework/zendframework Version ~2.0
symfony/process Version ~2.0