This Git repository contains examples of the three types of design patterns: creational, structural, and behavioral design patterns implemented in PHP.
Creational design patterns focus on object creation mechanisms, trying to create objects in a manner suitable to the situation. The examples in this repository for Creational Design Patterns include:
- Singleton Pattern
- Factory Pattern
- Abstract Factory Pattern
- Builder Pattern
- Prototype Pattern
Structural design patterns are concerned with object composition and provide class and object composition structures that can be utilized to form large structures. The examples in this repository for Structural Design Patterns include:
- Adapter Pattern
- Bridge Pattern
- Composite Pattern
- Decorator Pattern
- Façade Pattern
- Flyweight Pattern
- Proxy Pattern
Behavioral design patterns are concerned with communication between objects, encapsulating behavior in objects, and delegating requests to appropriate objects. The examples in this repository for Behavioral Design Patterns include:
- Chain of Responsibility Pattern
- Command Pattern
- Interpreter Pattern
- Iterator Pattern
- Mediator Pattern
- Memento Pattern
- Observer Pattern
- State Pattern
- Strategy Pattern
- Template Method Pattern
- Visitor Pattern
To learn more about PHP Design Patterns, you can visit our repository and explore the examples provided.
To use this project, simply clone the repository and run it on your local machine.
To run this project, you will need to have PHP installed on your machine.
- Clone the repository to your local machine using
git clone <https://github.com/burakaktna/DesignPatternsPHP.git
> - Navigate to the project directory using the command line or terminal
- Run
php Examples/{example-file-name}.php
to execute the example for the design pattern of your choice
If you would like to contribute to this project, please fork the repository and submit a pull request.
- Muhammed Burak AKTUNA
This project is licensed under the MIT License - see the LICENSE.md file for details.
Thank you to the following resources for their guidance and inspiration:
- Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
- Head First Design Patterns by Eric Freeman and Elisabeth Robson