views:

1341

answers:

4
+9  Q: 

Do you use Phing?

Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just checkout from SVN and run it. It sets some basic configuration variables, installs or reloads the database, and generates a v-host for the site instance.

I have often thought that maybe we should be using Phing. I haven't used ant much, so I don't have a real sense of what Phing is supposed to do other than script the copying of files from one place to another much as our setup script does. What are some more advanced uses that you can give examples of to help me understand why we would or would not want to integrate Phing into our process.

+4  A: 

From Federico Cargnelutti's blog post:

Features include file transformations (e.g. token replacement, XSLT transformation, Smarty template transformations), file system operations, interactive build support, SQL execution, CVS operations, tools for creating PEAR packages, and much more.

Of course you could write custom scripts for all of the above. However, using a specialized build tool like Phing gives you a number of benefits. You'll be using a proven framework so instead of having to worry about setting up "infrastructure" you can focus on the code you need to write. Using Phing will also make it easier for when new members join your team, they'll be able to understand what is going on if they've used Phing (or Ant, which is what Phing is based on) before.

Ryan Guest
+1  A: 

I don't see any compelling reason to go with phing. I mean, should PHP programmers attempt a rewrite of Eclipse "just because" it might somehow be easier to write Eclipse plugins in PHP? I don't think so.

Ant has better documentation, including some nice o'reilly books, and it's well-established in the Java universe, so you avoid the problems of (1) "we haven't copied feature X to phing yet" and (2) the risk of the phing project going dead. Here's an article on configuring PHPUnit to work with ant and cruisecontrol: not that hard. And you get eclipse integration for free.

Good luck!

Well, rewriting Eclipse is probably not the best idea, having Ant port in PHP is really great idea. The reason is simple: custom tasks, that can be done in plain old PHP (not everybody knows Java well enough). Building application, more than often, involves custom functionality that begs to be automated, and ability to do so in language you are proficient at - well, to me it could be considered as a great plus.P.S. If you are using Java, then you probably should look at Maven :))
Victor Farazdagi
+1  A: 

I moved from Ant to Phing 'just because' it's PHP. I use it to export from different subversion repositories, copy stuff around, build different installation packages, etc all of that with a 20 line reusable xml file and a config file with project specific stuff. No way I could do it that fast with a custom script. I also plan to integrate api documentation generation and unit tests. Love it!

+3  A: 

The compelling answer for me is that phing understands PHP classpaths. Ant doesn't. I don't want to have an ant build.xml full of exec commands. I happen to be primarily a java programmer and still use phing. It's the best tool for the job.