An Introduction to PEAR
PEAR is short for “PHP Extension and Application Repository” and is pronounced just like the fruit. It is a repository of PHP software code. The PEAR project was founded in 1999 by Stig S. Bakken to promote the re-use of code that performs common functions.
PEAR is a code library that can reduce development time by supplying prewritten classes for standard functionality. PEAR contains functionality for a number of features, including database, mail, and error handling. PEAR provides a level of standardization that facilitates interoperability of functions.
PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality providing for authentication, networking, and file system features, as well as tools for working with XML and HTML templates. PECL Packages are extensions to PHP, written in C, that do not comply with the coding guidelines.
The purpose of PEAR is to provide:
A structured library of open-source code for PHP users
Each PEAR code package comprises an independent project under the PEAR umbrella. It has its own development team, versioning-control and documentation. Packages may relate to each other through explicit dependencies, but there is no automatic dependency relationship between packages based on the package name. For example, “HTTP_Post” is by default independent of “HTTP”.
A system for code distribution and package maintenance
All PEAR packages are registered in and downloaded from a central server at pear.php.net. All communication occurs over the HTTP protocol. Packages are distributed as a gzipped tar file with an XML description file inside. They contain source code or binaries or both. Many PEAR packages can readily be used by developers as ordinary third party code via simple include statements in PHP.
A standard style for code written in PHP
The PEAR Coding Standards apply to code that is part of the official PEAR distribution. Coding standards often abbreviated as CS among developers and they aim to keep code consistent to be easily readable and maintainable by most of PEAR folks. The PEAR Coding Standards defines about indenting and line length, control structures, function calls, function definitions, comments, including code, header comment blocks, naming conventions, etc.
The PHP Extension Community Library (PECL)
PECL (pronounced “pickle”) is a separate project that distributes PHP extensions. PECL extensions are also distributed as packages and can be installed using the PEAR installer with the pecl command. PECL contains C extensions for compiling into PHP. As C programs , PECL extensions run more efficiently than PEAR packages. PECL includes modules for XML-parsing, access to additional databases, mail-parsing, embedding Perl or Python in PHP scripts and for compiling PHP scripts.
A web site, mailing lists and download mirrors to support the PHP/PEAR community
One of the jobs of the PEAR Group is to issue administrative documents about diverse topics in PEAR. If you’re interested in submitting code for inclusion in PEAR, you can do so by joining the PEAR developer’s mailing list and requesting that your code be reviewed. To be considered, be sure to pay attention to functionality that’s already included and adhere to the PEAR coding guidelines. Submissions to PEAR are scrutinized by a panel, which provides quality assurance and reliability in the code.
As stated above, PEAR functionality is easy to deploy and requires no additional programming. By using quality prewritten, reusable code, you can tremendously shorten your development cycle.
Source:
1) PEAR Manual
2) http://en.wikipedia.org/PHP_Extension_and_Application_Repository
3) http://articles.techrepublic.com.com/5100-10878_11-1045409.html
From Mukesh Chapagain's Blog, post An Introduction to PEAR
