In the second article of a three-part series ' Using the Decorator pattern with PHP'; Alejandro Gervasio talks about how to apply the decorator design pattern within your Web applications. Comprised of two parts, the article walks you through the core concepts of using the pattern in PHP, and shows you its practical side with hands-on examples.
In the previous article, Gervasio provided pointers to demonstrate how the pattern works, and how it can be introduced in your PHP applications. He mentioned that the pre-requisite for understanding decorator patterns with PHP is to have a good understanding of object-based programming with PHP, since you'll see an abundance of material related to the topic. Gervasio began with an introduction to the basics of the decorator pattern, and demonstrated how it can be applied to PHP with several examples. He explained how to create a base class, define the structure of a Decorator object, and how to create additional decorator classes.
Gervasio begins the article by explaining how to work with MySQL result sets and the decorator pattern in PHP. He demonstrates how to handle MySQL result sets and retrieve them without changing the original class. Gervasio also defines decorator classes and provides ample code to enable better understanding.





