After reading the "Modern PHP workflow" article in the November 2008 edition of php|architect magazine which discussed unit testing (phpUnit), build tools (Phing) and continuous integration (Xinc), I'm inspired the learn more about some of the tooling available for PHP, especially Phing.
In the past I've often handled deployment to a production server by running the live site as a subversion working copy and simply running an "svn update" on the production box to deploy the latest version of the code.
Do you use build tools for PHP code? What advantages you you believe they offer over deploying direct from subversion? What should I look out for, or what gotchas might I face?
I have used both Phing and Ant and prefer the latter much more. I initially went with Phing due to it being written in PHP but to be honest it isn't as mature as Ant. In the end, having a mature buildsystem with a large community is worth more.
Things done with Ant/Phing:
A large issue that I see with Phing is that it creates a needless layer of indirection. PHP is a scripting language, and therefore could be run directly. Phing's use of XML configuration is a poor fit for the language: it does provide a more readable declarative configuration, but at the cost of sacrificing any of the flexibility of the language. With Ant (the inspiration for that route) it makes sense since Java did not have that flexibility as it is less dynamic and requires compilation.
Unfortunately I haven't seen many good alternatives in the PHP space, and unlike other languages build tools are not as essential or a part of the culture so the evolution of another well supported option may not happen any time soon.
I'd therefore stick to options that are closer to what PHP could do from cultures that more aggressively support build tools. I normally use Gradle. Rake also does a great job depending on with which language you want to cheat (and there may be other similar options). You should also weigh things like Webdriver support if you're into that type of thing. Otherwise creating a lightweight solution using PHP and/or BASH should cover everything while maintaining transparency
I looked at at Phing at it looks pretty awesome. For the project I'm working on I'm actually using Apache's Ant. I use it to do a several things:
I think Phing is worth looking at over Ant because it's native PHP, which could be nice. Also if you are doing anything more than just copy/moving files around look out for performance issues when you move to the production environment. I had an issue where the YUI compressor ran fine on my local machine but on the relatively small VPS it was super slow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With