2.1. Patterns in Existing Frameworks

Some of the things that make the most common PHP frameworks so successful are their careful architecture, maintainability, and extensibility. This is all a tribute to the proper use of Design Patterns in their initial architecture. This section pulls out a couple of examples of the use of these patterns for each framework. The goal is to demonstrate even more the proliferation of these patterns throughout your daily programming so that the reference chapters seem less daunting. If you see an example of a Design Pattern being featured in one of these frameworks, feel free to page ahead to that reference chapter to learn more about it.

It is important to reiterate that a Design Pattern is simply a template for constructing your program. Not every Design Pattern-based architecture will be one object to a pattern, nor will it follow the exact book specifications of that pattern. You will very often find classes created with more than one Design Pattern or that the base pattern has been heavily tweaked to fit into the particular context.

2.1.1. Design Patterns in PEAR

PEAR is one of the oldest libraries of PHP extensions. PEAR stands for PHP Extension of Application Repository. The PEAR website's quick summary of PEAR almost screams the potential for being a great example for Design Patterns, specifically this phrasing: "for reusable PHP components." While the newest versions of PHP are no longer bundling PEAR into the core distribution, I'm sure ...

Get Professional PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.