This repository contains examples of architecture and design patterns in PHP.
Each pattern is implemented as a small standalone project with its own:
composer.jsonREADME.mdsrc/directoryexamples/basic_usage.php
- Abstract Factory
- Builder
- Factory
- Object Pool
- Prototype
- Singleton
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Proxy
- Chain Of Responsibility
- Command
- Mediator
- Observer
- State
- Strategy
- Dependency Injection
- DTO
- Event Dispatcher
- Repository
- Service Layer
- Unit Of Work
Open any pattern directory and generate autoload files:
composer dump-autoloadRun the example:
php examples/basic_usage.phpExample:
cd structural/Facade
composer dump-autoload
php examples/basic_usage.php- PHP 8.1+
- Composer