Wednesday, July 9, 2008

About Phing

what is phing?

Phing is at heart a PHP clone of Ant, another common build and deployment tool.

Phing is a project build system based on Apache ant [ant]. You can do anything with Phing that you could do with a traditional build system like Gnu make [gnumake], and Phing's use of simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework.

How it works?

Phing uses XML buildfiles that contain a description of the things to do. The buildfile is structured into targets that contain the actual commands to perform (e.g. commands to copy a file, delete a directory, perform a DB query, etc.). So, to use Phing, you would first write your buildfile and then you would run phing, specifying the target in your buildfile that you want to execute.

% phing -f mybuildfile.xml mytarget

By default Phing will look for a buildfile named build.xml (so you don't have to specify the buildfile name unless it is not build.xml) and if no target is specified Phing will try to execute the default target, as specified in the tag.

You can install Phing as follows.

pear channel-discover
pear install phing/phing

Calling Phing

Command Line

Phing execution on the command line is simple. Just change to the directory where your buildfile resides and type

$ phing [targetname]

at the command line (where [targetname] is the target you want to be executed)