FallenRayne Dev One developer's random thoughts are better than nothing.

22Dec/100

Phing – A quick intro

Phing is a build system that is entirely built using PHP and is based off of Apache Ant. I have been checking Phing out a bit lately due to needing to automate a bunch of tasks at my job. I kept seeing Phing mentioned on various websites and decided that it could be a pretty good choice after seeing what it was capable of. The tasks we want to automate are:

  • Transferring data from one database to another regularly
  • Doing weekly releases, sending e-mail upon completion to our users and the help desk
  • Running PHPUnit tests on a regular basis
  • Building PHPDoc for every release
  • Bringing on new customers (database changes, file changes, account creation, etc...)
  • Hiring new developers (account creation, directory creation, svn checkouts, etc...)

As you can see, we have a decent little laundry list of things that we could automate and with some research I figured out how to do all of these with Phing. The big selling point for us was the fact that Phing can be extended using Tasks. Tasks are basically PHP scripts that are run in Phing through XML tags. This makes anything that is possible for PHP to do for Phing to automate. Phing can send e-mail, manipulate the file system, access APIs, make database changes, and even build a menu system so that all of your common tasks can be accessed from one script even if the scripts are separated into multiple files.

Next week I am going to show an example build script that I worked on that makes a basic menu system that you can leave up all day to accomplish all of your common command line tasks. I used to have one written in Bash but I seemed to have misplaced it and it only ran on Linux anyways. With Phing I can run the build script on Windows, Linux, or Mac.  Better yet, I can even run it on my Ubuntu machine and have it SSH into my Windows machine to accomplish additional tasks if need be.

Comments (0) Trackbacks (0)

No comments yet.


Leave a Reply

No trackbacks yet.