Using Phing with Travis CI

We’ve started using Travis CI on one of my projects to run some build processes to check that everything looks good before we merge/deploy code. One thing I ran into quite quickly was that I wanted to install phing in order to use the build scripts we already have and use elsewhere, but that it isn’t provided by default by Travis CI.

In fact, you can install phing by adding it to the before_install section of your .travis.yml; so the file could look something like this:

language: php
  - "5.4"

  - pear channel-discover
  - pear install phing/phing
  - phpenv rehash

    - phing -f src/build.xml phplint

That rehash is the magic sauce that makes your path pick up phing and so be able to run the command in the script section. I expect phing to be quite a common requirements for PHP projects, so it’s good to know that it can easily be used with TravisCI.

7 thoughts on “Using Phing with Travis CI

  1. Have you considered adding Phing in your composer.json file in the require-dev section ?

    The you can use composer by executing the command `vendor/bin/phing`

    • Good tip. As I just replied to someone else, this project actually doesn’t use composer but for others solving the same problem this could well be handy advice, thanks

  2. Pingback: Links for my PHPDublin phing talk. | Ken Guest’s online diary

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.