PHP Framework
December 10th, 2007
I haven’t talked about my PHP framework in quite a while. One feature that I really like is the unit testing and functional testing components. Using the framework, you can easily write unit tests that automatically get run from the test harness, complete with output. The functional testing works using the Selenium web runner. If you aren’t familiar with Selenium, you should be! I use the Selenium IDE (FireFox extension) to record a given test and using the custom formatter it produces PHP code for use in the web runner. What you end up with in the framework is a complete automated testing facility.
I am also using the log4php logging mechanism in the framework. Anything Log4J can do, Log4PHP can do too. Even Chainsaw. I can fire up Chainsaw and get remote logging from my webapps, as well as remote logging/debugging within any JavaScript I am using. I wish I had the time to properly document, clean up, and package the framework for distribution. But then again, I guess it would be “Yet Another Framework”. Either way, it’s a better framework for me than any of the popular ones.
Cool Bug Reporting
November 29th, 2007
I cranked out a little library today for submitting bug reports in-line from a web app ajax style (probably am only going to use it for beta testing apps, but it could easily be left in for production use). Here’s the scoop: Trac has an XML-RPC plugin that enables some of it’s interfaces to an RPC server (which interfaces and permissions controlled by Trac WebAdmin of course). So I installed and configured that, and then added a hidden div to my UI template in a test project with a form for submitting a bug, which when POSTED, PHP shoots it directly into the Trac project with a description, the users $_SERVER array, and $_SESSION array. The bug reporting form is activated/made visible by pressing ctrl+alt+b from any page in the application (thanks MooTools!). Slick is all I’m going to say. Lot’s of possibilities for extending this. Maybe if I get some time I will package it up for use. If you are interested in it sooner, holla.
Web Application Build Process
January 25th, 2007
Somebody asked me recently how I manage upgrades, etc. on web applications. Warning: this might seem like overkill to some people.
The short answer? ANT
That’s right I said it, ANT. I used to use ANT quite a bit when I was heavy into Java development and it quickly became my best friend. A couple of years have passed since I’ve used it, but once I set up my PHP build/deployment process I knew right where to go for some serious horsepower. So my system setup consists of:
- ANT
- ANT add-ons
- JSPacker
- Natural Docs
My build process differs from development to deployment (as it should). Things like optimization, etc. are left out of the development build. For deployment, I strip all comments out of the Javascript and CSS code, and run them through a compression utility to lighten the footprint up a bit. (BTW, I generally use gzip compression on the server to deliver those as well).
So my development involves editing files locally in either CVS or Subversion. When I’m ready to test, I fire up ANT and run a “dev” target which simply copies the files to the web server. When I’m ready to deploy, I use ANT to generate all of the documentation (Javascript and PHP), run the optimization targets (comment stripping and compression), build an archive (gzipped tar), do any necessary backups, run any necessary SQL update scripts, and deploy the new application or revision via FTP or SCP to the destination server. It’s all very automated and precise - a way of doing things that I geek out about and could not imagine doing any other way!
If you’re interested in more details or a sample build.xml file that I use, just ask.