I’m not sure if you’ll understand the way I interpreted it. Forgive my spider web brain. I should have used software modelling tool instead of MS Paint :D :D :D ... But nah! :D hehe

There are still lots of patterns to learn but below are the most common. You can check it at: https://github.com/DesignPatternsPHP

Decorator Pattern

The purpose of decorator pattern is it dynamically adds new functionality to class instances.

Interfaces allow to specify what methods a class should implement. 

To implement an interface, the implements operator is used. All methods in the interface must be  implemented within a class.



54 Basic inspection and oil change.

Adapter Pattern

The purpose of an adapter pattern is it  allows you to translate one interface to use with another.

Think of it as the same  usage of a real world adapter. An adapter is a device that converts attributes of one electrical device or system to those of an otherwise incompatible device or system.


Template Pattern

The purpose of template pattern is to remove duplication implementation. Template pattern is an abstract class exposes defined ways/templates to execute its methods. Abstract classes and methods are when the parent class has a named method, but need its child classes to fill out the tasks. An abstract method is a method that is declared, but not implemented in the code.


(new TurkeySub)->make();


laying down a bread

add some lettuce

add Turkey

add some sauces

(new VeggieSub)->make();


laying down a bread

add some lettuce

add Veggie

add some sauces

Strategy Pattern

The purpose of strategy pattern is to define a family of algorithms, encapsulates each one and make them interchangeable.



Log the data to a Saas site. Log the data to the database.

Chain of Responsibility Pattern

The purpose of this pattern is it literally allows us to chain any number of objects, where each has the option of either handling a particular request, or deferring to the next object in the cycle.



Order of chain should all be true. Otherwise it will throw an exception error. For example, I'll set $alarmOn to false. The error result is:

Fatal error: Uncaught Exception: Alarm not set! 

Observer Pattern

The purpose of this pattern is it basically  triggers a code to run when certain events happened. 



string(13) "Log something" string(13) "Fire an email" string(14) "Reporter Login"