HYIP-Man: 5 tools every PHP programmer should know about
Friday, August 17, 2007
5 tools every PHP programmer should know about

After working on several large scale PHP projects, and writing a lot of PHP code, I've discovered a number of tools that improve code quality, streamline rollouts, and generally make life as a PHP developer a whole lot easier. Many of these tools probably deserve a post of their own. But, since some people aren't even aware that these tools exist, I figured I'd start there. So, without further ado, here's my list of tools that every PHP programmer should know about.

Phing - a project build system

Phing LogoPhing is a project build system based on Apache ANT. The name is a recursive acronym, of sorts, that stands for PHing Is Not GNU make. Phing can do anything a traditional build system like GNU make can do, but without the steep learning curve.

The idea behind phing (and other build tools) is to evaluate a set of dependencies, then execute a set of PHP classes to properly install and configure an application. The build process is controlled by a simple XML configuration file. Out of the box, phing can perform token replacement (e.g., to change include paths on your development and production systems), execute SQL, move and copy files, run shell scripts, and more. You can also create your own custom tasks by extending the "task" class included with the package.

Phing is an invaluable tool for anyone who needs to deploy large scale PHP applications on more than a single server. But I've found it useful for simple scripts, too.

Xdebug - debugger and profiler tool

Xdebug LogoXdebug is a PHP extension that helps you debug and profile scripts. Among the most useful features of Xdebug are the new notice, warning, and error messages that are displayed after activation. If a script fails to execute properly, Xdebug will print a full stack trace in the error message, along with function names, parameter values, source files, and line numbers. A welcome feature for developers who are tired of the skimpy error reports from a default PHP install.

The extension has a number of more advanced features that allow developers to perform code coverage analysis, collect profiling information, and debug scripts interactively. The profiling functionality is particularly useful. The profiler uses a common output file format, allowing you to use tools like KCacheGrind to quickly find bottlenecks in your code. A good profiler is an essential tool for any serious developer, as it allows you to properly optimize your code while avoiding the hazards of premature optimization.

PHPUnit - unit testing framework

PHPUnit logoPHPUnit is a lightweight testing framework for PHP. It's a complete port of JUnit 3.8.1 for PHP5, and is a member of the xUnit family of testing frameworks (which are based on a design by software patterns pioneer Kent Beck).

Unit tests form the foundation of several modern agile development methodologies, making PHPUnit a vital tool for many large scale PHP projects. The tool can also be used to generate code coverage reports using the Xdebug extension discussed earlier, and integrates with phing to automate testing.

Propel - object-relational mapping framework

Propel LogoPropel is an Object-Relational Mapping (ORM) framework for PHP5 that was originally based on the Apache Torque project. It provides a sophisticated, but easy to use database abstraction layer that allows you to work with database entities the same way you work with normal classes and objects in PHP. Propel allows you to define your database in a simple XML format which it uses to construct the database, and generate static classes for use in your application.

Propel is integrated into the popular Symfony PHP framework (among others), which has helped keep the code base flexible, modular, and portable. The project has excellent documentation, and a great support community.

phpMyAdmin / phpPgAdmin - web-based database administration

phpMyAdmin LogoAn oldy but a goody, phpMyAdmin is one of the most useful administrative tools available for any database (along with it's PostgreSQL and SQLite cousins phpPgAdmin and phpSQLiteAdmin) . It's useful for everything from constructing and altering databases to debugging applications and making backups. This is often the first thing I install after Apache, PHP and MySQL on a LAMP server. If you use MySQL, and somehow you haven't heard of it, install it now.

Other Stuff

There are tons of excellent tools that fill all sorts of niches, and help provide a rich environment for PHP developers — I wish I could mention them all. A few more that I've found useful myself are PHP Beautifier, Spyc, Creole, and Smarty. I'm sure there are tons more that I either forgot, or have never heard of. So if you know of a great PHP development tool that I left out, please post a comment and let me (and everyone else) know about it!

source

Labels: