PEAR:: Classes Worthy Of AttentionMattias Geniar, Monday, January 26, 2009 - last modified: Sunday, January 25, 2009
PEAR offers an excellent framework for re-usable PHP components. A wide range of PEAR classes is available, from XML Parsers to Captcha's and Mail components.
They're all easy to install, and have extensive documentation available so you can get started right away. Here's a list of some of the better, and probably lesser known ones.
PEAR's Mail package defines an interface for implementing mailers under the PEAR hierarchy. It also provides supporting functions useful to multiple mailer backends. Currently supported backends include: PHP's native mail() function, sendmail, and SMTP. This package also provides a RFC822 email address list validation utility class.
This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks.
Provide functionality for dealing with MIME types, such as auto-detecting MIME type on files.
Net_Socket is a class interface to TCP sockets. It provides blocking and non-blocking operation, with different reading and writing modes (byte-wise, block-wise, line-wise and special formats like network byte-order ip addresses). It provides the base class for other popular PEAR-classes such as Net_SMTP and HTTP_Request.
This class provides handling of tar files in PHP.
It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.
The list of available packages goes on for miles, and includes a Facebook package, a Number-to-Words convertor, Command line Argument Parser, CAPTCHA generator, Barcode Generator, ... Too much to mention!
For installation instructions, I'll refer you to the following two posts:
I'm interested to know what PEAR packages you're using, and why. Where do you draw the line between writing your own classes, and switching to PEAR's?