In this lesson you have learned about the security considerations involved in building a dynamic website using PHP. In the
Lesson 25. Using PEAR
In this lesson you will learn about the PHP Extension and Application Repository (PEAR).
PEAR is a framework and distribution system for reusable PHP packages. PEAR is made up of the following:
The PEAR Code Library
You use the PEAR installer, which is shipped with PHP, to automatically download and install a PEAR package by simply giving its
Each package may have dependencies from other PEAR packages, and this is explicitly noted in the documentation, even if packages appear to be
A package tree structure exists within PEAR, and an
Package Distribution and Maintenance
PEAR packages are registered in a central database at http://pear.php.net. The PEAR website provides a searchable interface to the database by package name, category, and release date.
Maintainers of PEAR packages use the PEAR website to manage their projects. A CVS server allows developers to collaborate on source code and, once a release has been agreed upon, it can be made available from this central location immediately.
PEAR Coding Standards
The PCS documents were created because many different
The documents in PCS outline a structured way in which code should be written in order for a package to be accepted as part of the PEAR project. The standards are quite detailed and contain mostly points of style, such as identifier naming conventions and a consistent style to use when declaring functions and classes.
This may sound a little daunting, but as your scripts become more complicated, you will realize how important it is to write readable code, and you will begin to develop a clear coding style. The PCS documentation simply formalizes a set of guidelines for writing readable PHP.
You can find the PCS documents online at http://pear.php.net/manual/en/standards.php.
PHP Foundation Classes
PFC is a subset of PEAR packages, and these classes have a strict set of
At the present time, only the PEAR installer is shipped with PHP. However, at a later date, certain classes may be included as standard. The PFC would be those classes.
Online Support for PEAR
The PEAR website, at http://pear.php.net, includes comprehensive online documentation for the PEAR project. The package database can be searched via the website, and package maintainers can log in to update their project details.
There are a number of mailing lists for PEAR users, maintainers,