Book description
Build server-side applications more efficiently—and improve your PHP programming skills in the process—by learning how to use design patterns in your code. This book shows you how to apply several object-oriented patterns through simple examples, and demonstrates many of them in full-fledged working applications.
Learn how these reusable patterns help you solve complex problems, organize object-oriented code, and revise a big project by only changing small parts. With Learning PHP Design Patterns, you’ll learn how to adopt a more sophisticated programming style and dramatically reduce development time.
- Learn design pattern concepts, including how to select patterns to handle specific problems
- Get an overview of object-oriented programming concepts such as composition, encapsulation, polymorphism, and inheritance
- Apply creational design patterns to create pages dynamically, using a factory method instead of direct instantiation
- Make changes to existing objects or structure without having to change the original code, using structural design patterns
- Use behavioral patterns to help objects work together to perform tasks
- Interact with MySQL, using behavioral patterns such as Proxy and Chain of Responsibility
- Explore ways to use PHP’s built-in design pattern interfaces
Publisher resources
Table of contents
- Learning PHP Design Patterns
- Dedication
- Preface
-
I. Easing into the Fundamentals of Design Patterns
- 1. PHP and Object-Oriented Programming
- 2. Basic Concepts in OOP
- 3. Basic Design Pattern Concepts
- 4. Using UMLs with Design Patterns
-
II. Creational Design Patterns
-
5. Factory Method Design Pattern
- What Is the Factory Method Pattern?
- When to Use the Factory Method
- A Minimalist Example
-
Accommodating Class Changes
- Adding Graphic Elements
- Coordinating Products
- Changing the Text Product
- Changing the Graphic Product
- Adding New Products and Parameterized Requests
- One Factory and Multiple Products
- The New Factories
- The New Products
- The Client with Parameters
- Helper Classes
- File Diagram
- Product Changes: Leave the Interface Alone!
- 6. Prototype Design Pattern
-
5. Factory Method Design Pattern
-
III. Structural Design Patterns
- 7. The Adapter Pattern
- 8. Decorator Design Pattern
-
IV. Behavioral Design Patterns
-
9. The Template Method Pattern
- What Is the Template Method Pattern?
- When to Use the Template Method
- Using the Template Method with Images and Captions: A Minimal Example
- The Client
- The Hollywood Principle
- Using the Template Method with Other Design Patterns
- The Factory Method Participants
- The Hook in the Template Method Design Pattern
- The Small and Mighty Template Method
- 10. The State Design Pattern
-
9. The Template Method Pattern
-
V. MySQL and PHP Design Patterns
- 11. A Universal Class for Connections and a Proxy Pattern for Security
- 12. The Flexibility of the Strategy Design Pattern
- 13. The Chain of Responsibility Design Pattern
- 14. Building a Multidevice CMS with the Observer Pattern
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: Learning PHP Design Patterns
- Author(s):
- Release date: February 2013
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449344870
You might also like
book
Mastering PHP Design Patterns
Develop robust and reusable code using a multitude of design patterns for PHP 7 About This …
book
Design Patterns in PHP and Laravel
Learn each of the original gang of four design patterns, and how they are relevant to …
book
Domain-Driven Design in PHP
Real examples written in PHP showcasing DDD Architectural Styles, Tactical Design, and Bounded Context Integration About …
book
Learning PHP
If you want to get started with PHP, this book is essential. Author David Sklar ( …