6. The PHP Extension and Application Repository
Although you may very well be as unique and special as your mother claims, chances are that the code you’re currently attempting to write has been cranked out by other developers countless times before. To help developers quickly surpass shared obstacles, PHP developers regularly contribute to the PHP Extension and Application Repository, better known as PEAR. Hosting 560 packages, which can offer turn-key solutions to problems such as caching, encryption, user authentication, and payment processing, chances are you’ll find a PEAR package that suits your “unique” needs.
To help manage your PEAR packages, you can install the PEAR package manager, which provides a command-line interface to installing, upgrading and deleting packages.
Like the Editor Wars, arguments over coding conventions remain bitter. Even so, the PEAR Coding Standards seem to have gained a foothold within the PHP community, offering a sane approach to conventions (which I personally employ in my own projects). However, it can be easy for you or a team member to depart from these conventions, resulting in inconsistent code.
There are few tasks more frustrating than attempting to decipher poorly documented source code, even if it’s code that you personally wrote some time ago. Yet like testing, documentation remains one of those tasks that developers tend to avoid at all costs. To alleviate the pain, consider using an automated documentation framework such as phpDocumentor. Supporting a simple documentation syntax, phpDocumentor will parse your source files and generate user-friendly documentation for you!
To learn more about phpDocumentor, check out the introductory tutorial I wrote on the topic some years ago titled Documenting PHP Code with PHPDocumentor, and be sure to check out the understandably great documentation on the PHPDocumentor website.
Another hindrance to understanding the intent of source code is poor formatting. Yet in the heat of banging out reams of new scripts, it can be easy to improperly indent and organize your code. You can automate this process using the PEAR package PHP_Beautifier, which among other tasks will properly indent your code and add newlines.
If you’re considering embracing one or more of the aforementioned utilities, consider checking out the continuous integration tool known as phpUnderControl. Built atop CruiseControl, phpUnderControl packages several PHP tools together, including PHPUnit and phpDocumentor, to provide a unified interface for managing these features.
Do you have a favorite PHP-oriented productivity-enhancing utility not mentioned here? Tell us about it in the comments!