This repository provides a comprehensive collection of Design Pattern examples in PHP, neatly organized into the three main pattern categories:
- Creational
- Structural
- Behavioral
Each pattern is implemented in clean, modern PHP code with concise examples to help developers understand their intent and use cases.
These patterns deal with object creation mechanisms. They aim to reduce complexity and increase flexibility in instantiating objects.
Examples:
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
Structural patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.
Examples:
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Proxy
- Flyweight
Behavioral patterns focus on communication between objects, helping to ensure that systems are both flexible and maintainable.
Examples:
- Strategy
- Observer
- State
- Command
- Chain of Responsibility
- Template Method
- Iterator
- Mediator
βββ creational/
β βββ [PatternName]/
β βββ *.php
βββ structural/
β βββ [PatternName]/
β βββ *.php
βββ behavioral/
β βββ [PatternName]/
β βββ *.php