Book Image

Mastering PHP Design Patterns

By : Junade Ali
Book Image

Mastering PHP Design Patterns

By: Junade Ali

Overview of this book

Design patterns are a clever way to solve common architectural issues that arise during software development. With an increase in demand for enhanced programming techniques and the versatile nature of PHP, a deep understanding of PHP design patterns is critical to achieve efficiency while coding. This comprehensive guide will show you how to achieve better organization structure over your code through learning common methodologies to solve architectural problems. You’ll also learn about the new functionalities that PHP 7 has to offer. Starting with a brief introduction to design patterns, you quickly dive deep into the three main architectural patterns: Creational, Behavioral, and Structural popularly known as the Gang of Four patterns. Over the course of the book, you will get a deep understanding of object creation mechanisms, advanced techniques that address issues concerned with linking objects together, and improved methods to access your code. You will also learn about Anti-Patterns and the best methodologies to adopt when building a PHP 7 application. With a concluding chapter on best practices, this book is a complete guide that will equip you to utilize design patterns in PHP 7 to achieve maximum productivity, ensuring an enhanced software development experience.
Table of Contents (14 chapters)
Mastering PHP Design Patterns
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Summary


This chapter extended the design patterns we started to learn in the previous chapter by introducing structural design patterns.

To this end, we learned some critical patterns to ease the software design process; these patterns identify a simple way to realize the relationships between different entities:

  • We learned about the Decorator, how to wrap classes to add additional behavior to them, and critically, we learned how this can help us comply with the Single Responsibility Principle.

  • We learned about Class and Object Adapters, and the difference between them. The critical takeaway here is the arguments for why we may choose composition over inheritance.

  • We reviewed the FlyWeight design pattern, which can help us perform certain processes in a memory-efficient manner.

  • We learned how the Composite design pattern can help us treat compositions of objects the same as individual objects.

  • We covered the Bridge design pattern, which lets us decouple our abstraction from its implementation...