(PHP version 7.4 or greater)
The intention is to simplify the ideas of different design patterns. The code examples are overly simplified. These examples only focuses on what's important and additional operations kept to as minimal as possible. It's more like proof of concept.
Example uses of design patterns can be found in index.php
in the root directory. You can either run it
from terminal or built-in php server.
Run from terminal:
php index.php
Run built-in server:
php -S localhost:8000
- Factory method
- Abstract factory
- Builder
- Prototype
- Singleton
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
- Chain of responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template method
- Visitor
Run command on project root directory:
./vendor/bin/phpunit --testdox --color=always
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --color=always