Skip to content

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

Notifications You must be signed in to change notification settings

phpManiac77/zf2-module-phing-service

 
 

Repository files navigation

BsbPhingService

Introduction

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

Requirements

Release information

  • v1.0.0-beta1 - initial release
  • v1.0.0-beta2 - 'composerized', updated to zf2-beta-4
  • v1.0.0-beta3 - updated to zf2 2.0.0+ ! BC Break by namespace and configuration changes!
  • v1.0.0 - First release

Build Status

Installation

Using Composer (recommended)

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 dependancies.

"require":{
    "bushbaby/zf2-module-phing-service":"1.*",
 },

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);. The build method returns an associative array that contains the return status of the phing executable, the command has been issued and any output generated by phing (Both stdout and stderr are captured).

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['returnStatus'] > 0) {
  	    // problem
        echo $buildResult['command'];
        echo $buildResult['output'];
    } else {
        // yeah
        echo $buildResult['output'];
    }

    $view = new ViewModel($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.

License

The MIT License (MIT) Copyright (c) 2012 bushbaby multimedia

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Phing has it's own licence Phing licence

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%