This package is abandoned and no longer maintained. No replacement package was suggested.

Zend Framework 2 module for Phing, a PHP project build system or build tool based on Apache Ant.

2.0.0 2015-02-03 15:02 UTC

This package is auto-updated.

Last update: 2021-07-23 21:23:40 UTC



BsbPhingService is module for Zend Framework 2 that will enable you to execute phing build files from within ZF2 projects.



Latest Stable Version Total Downloads Latest Unstable Version License

[Build Status](Build Status) Code Coverage Scrutinizer Code Quality Dependency Status


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.


and then update

cd /to/your/project/directory
./composer.phar update -v


  • 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'.

$process = $phingService->build('target', array('buildFile' => 'build.xml'));

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.

$process = $phingService->build('target', array('buildFile' => 'build.xml'), false);
$process->run(function ($type, $buffer) {
    if (Process::ERR === $type) {
        echo 'ERR > '.$buffer;
    } else {
        echo 'OUT > '.$buffer;

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.