Six PHP Essentials You Can’t Live Without
Monday, March 19th, 2007PHP, or PHP: Hypertext Preprocessor, is a versatile Web programming language that stands behind some of the world’s largest Web sites. While the designers of the language have been the target of criticism pertaining to both security and usability, PHP has nonetheless evolved into one of the most extensible and popular languages powering the Web today.
Here are six of the PHP classes, extensions, and libraries that no developer should be forced to live without!
ADOdb
For development work that involves the use of a database, ADOdb is a must. This fast, mature, and portable database abstraction library provides much needed coherence, especially for those who have standardized on PHP 4. ADOdb includes support for MS SQL, MySQL, Oracle, and PostgreSQL, among many others.
Tip: Replace the standard MySQL functions in PHP 4 with ADOdb. You’ll thank yourself later.
Mcrypt and Mhash
http://www.php.net/mcrypt and http://www.php.net/mhash
These interfaces, which I’ve decided to present collectively, provide excellent support for strong encryption and various hash algorithms through Mcrypt and Mhash. Although both extensions were technically included with PHP until version 5.3.0, many installations of PHP are compiled without support for them, and relatively few users seem to be aware that these outstanding development tools exist.
Tip: Use these extensions to easily replace several broken or obsolete algorithms that are supported natively by PHP.
PHP-Imagick
http://pecl.php.net/package/imagick
It’s no secret to many PHP developers that the integrated support for GD has a number of serious limitations. ImageMagick is frequently regarded as the most comprehensive and powerful image manipulation suite, but many PHP developers are unaware that support exists for it. As it turns out, an extension by the name of PHP-Imagick provides an excellent alternative to the integrated GD functions.
Tip: Use PHP-Imagick to avoid roadblocks — for example, lossy thumbnails — when working with high resolution images.
PHPMailer
http://phpmailer.sourceforge.net/
As far as the mail() function is concerned, “quirky” is a vast understatement. Many critics and developers alike would argue that PHP allows you just enough rope to hang yourself and your users.
Fortunately, an alternative e-mail class exists in the form of PHPMailer, and it provides very clean, refined support for electronic mail. Its feature set includes SMTP redundancy, SMTP authentication, support for HTML, support for embedded images, and much more.
Tip: Combine PHPMailer with Smarty (see below) for a powerful e-mail template system.
SAJAX
http://www.modernmethod.com/sajax/
AJAX, short for Asynchronous JavaScript and XML, is a buzzword that describes a method by which interactive Web applications are created. It takes advantage of the XMLHttpRequest object, which allows an application to push or request content without refreshing the page.
Due to small variations in how the XMLHttpRequest object has been implemented by the various browser manufacturers, it can be tedious and time-consuming to roll your own AJAX implementation. Fortunately, SAJAX provides a straightforward framework upon which to build an AJAX application, saving precious development time.
Tip: Keep in mind that there are caveats to AJAX. For example, it’s easy to break browser navigation or make your application inaccessible to search engine spiders, so use it with caution.
Smarty
It’s always best to separate your code from your content. Smarty, one of the best template engines for PHP, is built to serve that purpose, as well as many others.
It provides an excellent framework upon which to standardize your templates. Additionally, with its advanced support for caching, Smarty often proves itself more efficient than the competition. If you’re thinking about rolling out your own template engine, consider saving yourself some time by adopting Smarty.






