My design pattern examples
This repo is various design patterns that I come across during development. This is meant for a reference and anyone interested in how certain patterns work in php.
Active Record Pattern
Example of an Active Record Pattern for centralize database access.
Adapter pattern using Sendgrid API and Twilio.
Strategic Pattern (Composition over Inheritance)
This is located in src/Composition and shows the benefits of using composition over inheritance. This example uses a Duck and is based off of the Head First Design Patterns chapter 1.
Example of a Decorator pattern using a Weapon and Damage modifiers as examples.
Example of using a Factory Pattern for object creation.
This is located in src/Observer and shows the benefits of using an Observer pattern. The example is taken from Head First Design Patterns using a Weather Data fictional program.
Example of a very basic Singleton pattern. One of the easiest patterns to implement.