phpcomposer-phpphing

Running Composer-installed tasks in Phing


I have a PHP app that is getting its dependencies installed with Composer. Composer puts the binaries in the bin folder. I want to use Phing to execute some tests on my code, but Phing isn't finding the apps installed in {basedir}/bin/.

For example, this works:

 <exec command="./bin/phpcs --standard=zend ." passthru="true"></exec>

But this fails:

 <phpcodesniffer standard="ZEND" />

The Phing error message basically says that phpcs is not installed. How do I tell Phing to run the binary from the bin directory when using the built-in task for phpcodesniffer (which has nicer outputs than the exec example above)?


Solution

  • I answered my own question. I just needed to add this right above the phpcodesniffer line above:

    <exec command="export PATH=./bin:$PATH" />