Phing is a PHP build process that uses XML , ANT style syntax.
At some point in development, the choice is made to begin professional work. If more than 1 developer contributes to the effort, then an the easy mode of keeping in sync with that person and, in the future, others that may join the effort is required. Because not all developers are alike, and not all hosting providers are alike, you must have a solid build process of your code. The build process automates the routines that every developer must do, either daily, hourly, or with every code change as well as when code is pushed into client facing distributions. Phing is an XML to PHP build process that imitates the ANT build process that many development shops are used to. As a PHP developer, Phing is much easier for me to work with and get things done, as well as keeps things simple when needing to update the build process.
Straight from the source, “To use Phing you must have installed PHP version 5.2 or above compiled –with-libxml2, as well as –with-xsl if you want to make use of advanced functionality.” I would hope that if you are doing any serious PHP development, you would already meet these requirements. If you are needing to upgrade your PHP, then you really should reconsider what you are using PHP for.
My approach to installing Phing is the simplest solution and it follows exactly what the setup guide describes by using Pear.
You should now be able to test Phing by simply typing ‘phing’ from the command line. You should get an error similar to this: ‘Buildfile: build.xml does not exist!’
One of the most important parts of a build process is the ability to move and copy files to different places. Phing makes this easy and allows you to modify the files as you are moving them. Different reasons to have a build process will determine how you would like to set up your folder paths for Phing to manipulate. Let’s do one that is pretty powerful and pretty simple at the same time: copying all files from a folder, into a single file, located in an entirely different folder.
Now that we are concatenating our JS files, we can take it further and do some sanitizing with JSLint. Adding this to our current project is fairly simple. Start by downloading the most recent version of JSLint for your operating system. Make sure to uncompress the file and remember where you put the uncompressed file.
Hopefully this will get you into the process of using Phing and developing a solid build process in your web coding.