views:

1014

answers:

3

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?

+1  A: 

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:

  1. Combine and compress Javascript and CSS (compression done using the YUI Compressor
  2. Replace standard config files with production config files (e.g. rename config.php.production to config.php)
  3. Remove un-needed files (such as the ant build file, build.xml)

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.

Brian Fisher
I think the "implemented in PHP" argument is a bit overrated. It was the exact reason why we choose Phing in the first place but after 3 yrs we never made any changes to the core of Phing. Ant on the other hand is more mature/larger community and integrates nicely with PHP scripts if needed.
Jilles
Keep in mind that, for some of us, it's dependencies that are important, not modifiability. We just don't want to have to install all that Java stuff when we don't use any Java elsewhere.
ssokolow
+1  A: 

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:

  1. From a base checkout loalize to a specific language, ensure dependencies are there (other libs, directories, etc)
  2. if you have them, compile templates, etc
  3. Bring target database up to the required version, depending on the checked out code version
  4. run unit tests, etc
Jilles
Do phing.ant handle database migrations natively, or do they integrate with an external tool?
Jim OHalloran
Usually an external tool. (Depends on what you mean by "migrations" actually).
Jilles
A: 

On a project I'm working on now we're using phpUnderControl to run tests and get fast feedback when something's broken. We plan to use it to run other tests as well such as some written in Watir.

Jeffrey Fredrick