///Phing: A build system for PHP

Phing: A build system for PHP

As PHP applications grow in size and complexity of structure, developers often find themselves putting together a “deployment plan” – that is, a set of steps to go through each time they want to take the code and package, deploy or test it. This process could involve creating some deployment-specific configuration files, packaging up the code, storing the current state in version control, even setting up the database. Phing is a build system for PHP, based on Apache Ant, that aims to automate many of these processes and simplify application deployment for PHP developers.

Phing uses XML files to define automated build processes. Each buildfile includes some basic information about the project, and then a series of tasks. XML tags represent each task – for example, an <copy file=”…” tofile=”…”> is used for a file copy operation. Here’s a sample extract from one of these buildfiles:



    
        
        
    
    
        
        
    

Phing comes with quite a few tasks built in out of the box, such as file operations, PHPUnit and Subversion tasks, compression tasks and even a ZendCodeAnalyzer operation to analyse source files with the Zend Code Analysis tool. Phing is also extendible with PHP classes, and has access to the command line, giving it virtually limitless possibilities in what can be done during a build process.

Build systems like Phing are well suited to larger projects, where continuous integration is important. With Phing, your application can be prepared and built overnight, ready to test in the morning and saving hours of hacking around with deployment or one-liner install scripts. Some systems, Apache Ant especially, even integrate with IDEs – for example, some scripts can be run from within Zend Studio for Eclipse at the click of a button.

Getting started with Phing is easy; the project has a PEAR channel for quick and easy download, as well as thorough documentation covering every area of the system. PHPUnit, XDebug and PhpDocumentor can also be installed for added functionality, such as the inbuilt unit testing system. If you’re working on a sizable project and could use some decent automated build tools, head over to the Phing website for more details.

2010-05-19T22:04:42+00:00 June 26th, 2008|PHP|2 Comments

About the Author:

2 Comments

  1. JonGos June 29, 2008 at 4:56 PM

    I’m liking CakePHP these days, but this looks really interesting!

  2. Akash Mehta June 29, 2008 at 6:33 PM

    Actually, many of the major PHP frameworks can work really well with Phing; in fact, Symfony uses Phing out of the box.

Leave A Comment