7.1 Overview

PEAR is a web-based repository for common application components and PHP extensions. Version 1.0 was released as an integrated part of PHP 4.3.0 for Unix systems, and in PHP 4.3.2 for Microsoft Windows. The current release of PEAR includes packages for:

  • Working with HTML and HTTP

  • Manipulating and validating user data

  • Sending, receiving, and processing email

  • Credit card payment processing

  • Using web services including SOAP

  • Encryption

  • Reading and writing files including compressed archives

  • Graphing and image processing

  • Using XML

Each package is a separate product, with its own development team, but each uses PEAR foundation classes and almost all adhere to the PEAR coding standards. Similarly to PHP, the complete source code of the packages is available, and it's often useful as a supplement to the sparse and sometimes dated online documentation.

The package installation process is easy: packages are installed by typing a command at the shell prompt in Unix-style systems or by running a batch utility in Microsoft Windows. This is possible because all packages are registered and stored in the central http://pear.php.net repository that also provides account and version management to the developers. In addition, the packages are arranged so that if they depend on each other, you'll be alerted if you're missing a package during the installation process. We discuss installation in Section 7.3.3.

Our focus in this chapter is describing how you can install and use packages, and how to work with the Integrated Templates and PEAR DB packages. We also briefly discuss other packages, and some are discussed further in Chapter 9 where we discuss data validation.

PEAR has other components that we don't discuss in detail here:

  • A PHP coding standard primarily for the developers of packages.

  • PECL (pronounced pickle), a repository of C programming language extensions that have traditionally been distributed with PHP.

  • Gtk packages for use with the PHP-GTK project that provides tools for developing window-based applications. See http://gtk.php.net.