Chapter 7. PEAR
PEAR is the PHP Extension and Application Repository and is pronounced the same as the fruit. It provides standard, structured, maintained packages of code for common tasks such as data validation, accessing database servers, payment processing, using web services, processing images, and reading and writing files. Installing, updating, and using the PEAR packages is easy, and core components are now installed with the standard PHP installation. In this chapter, we explain how to build robust, maintainable middle-tier software using PEAR.
One of the original design features of PHP was its flexibility for adding scripts to HTML documents. For simple applications, this is an excellent feature. For complex applications, it leads to difficult-to-maintain code and inflexible HTML. We show you how to solve separating scripts from HTML using PEAR’s Integrated Templates. We also show you how make your PHP code independent of the database server you choose with PEAR’s DB layer. With these two techniques, you’ll be able to develop maintainable code that’s independent of the client and database tiers.
In addition to database access and templates, we also explain how to install PEAR packages and introduce 40 popular PEAR packages. Our case study application, Hugh and Dave’s Online Wines, is built with several of these PEAR packages, as well as PEAR DB and Integrated Templates. It’s discussed in detail in Chapter 16 through Chapter 20.
PEAR is a web-based repository for ...