Adapter Design Pattern with real-life example in PHP

Hasan Sheikh
Oct 30, 2022
Photo by Markus Winkler on Unsplash

What is Adapter design pattern?

The adapter pattern is a structural design pattern that allows you to re purpose a class with a different interface, allowing it to be used by a system which uses different calling methods.

Story

When you buy a new phone. Sometimes phones company provide a three-pin charger with the phone. Imagine you have no three-pin socket in your house. What do you do now? Of course, you buy a 2-pin adapter/converter. Now You can easily convert them from 3-pin to 2-pin. That’s called the adapter design pattern. I hope you understand.

Full article published on Syncodes

--

--