Here I am at Canada’s Web Shop, and I would like to talk about the PHP development support tools that I like to use and why.
I have used some of these tools in the past, and am familiar with their usage and benefits, and some of them are in their infancy themselves, and this is the first time I am trying them out. I am not sure whether I will make much use of them or whether they will be useful for my work, but since their running is automated (It’s “free!”), and the results nicely tie in with the other tools, why not?
Subversion for Version Control
Well, really any version control tool, but this one I am the most familiar with. Although I would have been just as happy about using Mercurial (ooh, new toy!), Subversion was chosen because of its maturity and apps and plug-ins for the largest number of operating systems and programming environments. In case you need an explanation as to why use version control, it is good for software development. In addition to the file versioning, I like to set up a post-commit hook to receive an email whenever any code is modified, detailing which files changed, and including a diff of the changes.
phpDocumentor for Web-based Documentation Generation
The phpDocumentor “is the current standard auto-documentation tool for the php language.” It provides a tool for auto-generating a simple to use set of Web pages including an overview of the code, and facilities to drill down all the way to a nicely colored source code listing (API docs). To put it simply, instead of surfing a 100K directory to find which file that class is defined in, or what are the arguments for that function, you get to surf a website.
PHPUnit for unit-testing
Unit-testing is the new black, everyone knows that. PHPUnit is a member of the xUnit family, and one of the two most popular stand-alone PHP unit-testing frameworks (the other is SimpleTest). Unit tests are a major component in having the confidence to change the code as requirements change, new PHP features come out in new versions, and programmers learn better ways of doing the same thing.
PHP CodeSniffer for checking for compliance to the coding standard
Coding standards are a great way to ensure each developer can easily follow another developers code. PHP_CodeSniffer is a PEAR project, and can review files for compliance to one of several popular coding standards, and can be extended. It produces a report on non-compliant code thus keeping the code readable.
PHP Mess Detector for source code analysis
PHPMD is a project by the same software developer that created phpUnderControl, and although it is in its infancy and limited in functionality, I think it can point out a few places where you can make that fairly good code into art (Is it $i or $num_displayed_products?). I am not really familiar with this tools functionality, but hopefully it will provide many unexpected benefits.
Cruise Control + phpUnderControl to tie it all together through automated builds continuous integration
But, Dan, we have to actually write software, we don’t have time to write and run tests, keep the documentation up to date, and run all the code analysis tools and produce reports. Enter continuous integration (CruiseControl + phpUnderControl). The main benefit here is time savings, consistency, and a usable interface that ties all of the above together.
Automated builds means if J. Random Luser again forgets to run the unit tests on the code he just wrote and broke some functionality, you can rest assured that your CI server will notify you; Is this documentation out of date? Nope, it is based on the latest version of the code from SVN. If you need instant gratification of your work, and to reassert the motivation for that tedious refactoring the brownfield code project, you just have to look at the metrics graphs that clearly show the progress of your project even though the software still does the same thing it did before.
Conclusion
In the following weeks, I will be writing tutorial-style articles about installing, configuring, and using each of the above. Until then, Happy Hacking!






[...] it was my turn to blog, and I wrote an article about PHP development support tools that I like to use and why. This entry was posted in Blogging, Canada's Web Shop. Bookmark the [...]