Team LiB
Previous Section Next Section

What Is PEAR?

Simply put, PEAR is the PHP Extension and Application Repository. The PEAR website defines it as "a framework and distribution system for reusable PHP components." Yet, over the years PEAR has evolved into something more than just a library of PHP classes. Other PHP code and class directories exist, so what sets PEAR apart from them?

A Code Library

First and foremost, PEAR is a library of reusable PHP code. This code is grouped together in what are referred to as packages. Each package represents an individual project complete with a development team that manages its releases and documentation.

Above all other coding libraries, PEAR is unique in its practice of package accountability. The Quality Assurance (QA) Initiative exists to ensure a level of high quality produced by the community. The first stable release of any major version for all packages must be approved by the QA Team. In addition, the QA Team tests each release for bugs and closely follows the progress of each package, sometimes becoming involved in resolving bugs themselves when package developers are unavailable. This practice, among others, sets PEAR apart as being a code library focused on quality.

A Coding Standard

Because quality is of utmost importance to each package in PEAR, a style guide for coding, the PEAR Coding Standards (PCS), has been adopted to ensure that every PEAR source file follows the same format. Although the standards themselves can be arguedand have beenthere are many benefits to having them, including code that is easily readable when passed from developer to developer.

The PCS has become so popular that many developers and organizations not affiliated with PEAR have adopted them as their own. Thus, PEAR is not only a repository of reusable code, but it has become synonymous with a standard of coding.

A System for Distribution and Maintenance

PEAR is also a system for distribution of code and package maintenance. The PEAR website maintains a central database of all Open Source packages. Developers may use the website or PEAR Package Manager (PPM)discussed later in this chapterto distribute and maintain packages. However, it may be noted that the PPM does not work only with packages from Rather, others may develop packages in accordance to the PEAR package structure and distribute them from other websites using the same system.

The PHP Foundation Classes

Every release of PHP since version 4.3.0 has included an installation of PEAR, including a base of preinstalled packages. These bundled packages are known as the PHP Foundation Classes (PFC). The PFC is a group of special classes that rigidly adhere to the PEAR Coding Standards and tout strict interoperability and forward compatibility. They are also chosen for their nature as general-use packages.

There will never be a less-than-stable package in the PFC, nor will there be a package that is specific to the Web or operating system. Packages in the PFC play well with other packages, so to speak, and they are extensible for future additions. It is this strict focus on quality and adherence to a set standard that win a package's place in the PFC.

These packages are probably the most known and recognized in PEAR, and, thus, they define PEAR as also being the PHP Foundation Classes.

The PEAR Package Manager

There is another part of PEAR that is also called pear. This is the PEAR Package Manager, or PPM, an executable program that provides functionality specifically for managing packages. The PPM, or pear program, comes with every standard installation of PEAR.

Although PEAR doesn't require the PPM, the PPM acts to tie together many of PEAR's key components. For example, the PPM may be used to search for and install packages from the code library, which also means that it is an important part of PEAR's system for distribution and maintenance. The PPM is also important to PEAR developers because it may be used to create packages and test them before release, among other things.

A Diverse Community

Finally, PEAR is not just a program or a code repository or a standard for coding, or any of the other elements mentioned. PEAR is also a community and a diverse one, at that.

The PEAR community consists of more than 700 members worldwide, a number that is continually growing. The diversity is most evident in discussions on the PEAR development mailing lists, where topics can sometimes involve heated debates. However, the community works very well together under the guidance of the PEAR Group, which serves to provide direction and to ensure that the goals of the project are met.

PEAR is many things to many people, and like all technologies, it is in a state of constant evolution, but these are the elements that define PEAR today. They are what it has become and what people think of when they think of PEAR. Because the overall project has reached a point of mature growth, these elements are more likely to solidify in status and change only slightly as the community continues to grow and the package list increases.

    Team LiB
    Previous Section Next Section