Home | Photography | Flickr | LiveJournal | Get Firefox

Phing: a build tool for PHP

Phing is a build tool for PHP. Much like Ant for Java, it is a tool to allow a more precise, more automated method of taking a source tree and deploying into a position where it can be run. This is a problem that plagues PHP application developers constantly. Every application you download has different instructions, different ways of setting up the TarBall filesystem, and each of them requires a little bit of fussing with this or that in order to get it up and running. Phing aims to be the "make" of the PHP world. And it seems to be doing pretty well. It's very flexible, and seems to be fairly straight forward. However, it does pose a problem.

PHP developers, myself included, are very used to being able to edit code live, should they choose to do so. They are also very used to just tarring up the document root and calling it a "package". Using "Phing" as your make tool requires a little more thought. First of all, instead of having a "config file" as your method of configuring an application, the build tool will handle most of the configuration by looking at a set of properties that you've established for your server. By using token substitution, an m4 style configuration approach occurs. Additionally, the application is internationalized by string substituion performed by the build tool.

All of this sounds good but I think it may be too much. Internationalization is great, but I really don't want my build tool to handle trying to figure out which language I want certain portions of whatever to be represented in. Token and string substituion can easily happen at runtime. The only exception to this is that, at runtime, if the internationalization handling can't represent a proper translation, and can't translate that fact properly either, the resulting error will have to be represented in a default language. However, this isn't much different than what the build tool would do because, if the build tool can't make the substitution you're requesting, it's going to fail and announce that fact in a default language anyway.

One of the primary reasons Phing was developed was to assist in the deployment of applications written in the BinaryCloud framework. Though I wasn't around when those choices were being made, it seems as though, what they were really looking for was a way to convert an XML description file into native PHP code in order to save the application from parsing XML on every call. This eventually led into creating Phing. I, however, think that a "build" process shouldn't be utilized for this purpose. I believe that such a translation belongs within the application and should be handled within a compile phase of the application itself, and not in its build tool. "Make" exists because attempting to compile a large C package file by file, library by library would take forever. On the other hand, PHP does not need compilation. If the files that support a particular application need work performed on them before they can be used, this should be handled by the application.

I feel that the only part of "make" that PHP needs is "make install". And Phing is certainly capable of performing "make install". But, then again, so is "make". However, having a native make tool for PHP is a nice feature, and it affords portability that "make" does not. Therefore, all in all, I think Phing is a great project and that it fills a nice little hole in the PHP software line. I just wish the BinaryCloud didn't rely on it so heavily.

If you'd like to play with Phing, you may find their website a bit disappointing if you're not running PHP5. Unfortunately, the website only has PHP5 versions of the code available. But, by visiting the BinaryCloud site at Tigris and visiting the CVS repository, under "r3/phing" a PHP4 version of the code can be found.

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Digg
  • e-mail
  • del.icio.us
  • Google
  • Reddit
  • Technorati
  • BlinkList
  • blogmarks
  • Blue Dot
  • description
  • Furl
  • Ma.gnolia
  • MisterWong
  • Netvouz
  • PlugIM
  • Propeller
  • Simpy
  • Spurl
  • TailRank

Trackbacks

blog comments powered by Disqus