There have been several add-ons developed for PHP in the last couple of years, but none have reached the popularity of PEAR. PEAR is a framework and distribution for reusable PHP components. In this article John introduces us to PEAR, and more specifically, its PEAR::DB package, which is a set of classes that allows us to create generic code to talk to a variety of databases with minimal code changes.
An Introduction to PEAR - What is PEAR? (Page 2 of 4 )
If you're familiar with Perl's CPAN library, then you'll find that PEAR is very similar in both concept and implementation. PEAR is an ongoing project that was started by Stig Bakken. Stig started PEAR to both encourage and define standards to help developers write reusable, portable, and efficient code. Although PEAR is still a work in progress, it is part of the GPL, and is therefore free to download and use.
The PEAR project is based on abstraction, which is essentially the process of remove all of the "junk" and only providing the bare minimum essentials to accomplish something. For example, PEAR's PEAR::DB package allows you to connect to a database by only specifying your database server, username and password. All of the connection settings and methods are performed internally to that class and are hidden from you.
Here's how Tomas Cox and Marin Jansen from pear.php.net describe PEAR:
PEAR is a repository for high quality PHP code and for PHP extensions written in C, that are distributed via an easy to use interface system.
Code in PEAR is compliant to the following points:
Has been approved to be part of PEAR by the PEAR developers and has the general consensus of the PEAR community.
Follows a unique coding standard (already standardized and used all over PEAR).
Uses a common error handling mechanism.
Tries to have a similar way of use.
Has documentation about its API in the PHPDoc format.
Has documentation/examples/test (to be marked as stable).
It's extremely easy to instantiate the classes that come bundled as PEAR packages, and the functionality of each package is excellent.