Structural patterns deal with class and object composition. Using interfaces or abstract classes and methods, they define ways to compose objects, which in turn obtain new functionality. The following is a list of patterns we categorize as structural patterns:
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Note
See https://en.wikipedia.org/wiki/Structural_pattern for more information about structural design patterns.
The adapter pattern allows the interface of an existing class to be used from another interface, basically, helping two incompatible interfaces to work together by converting the interface of one class into an interface expected by another class.
The following is an example of adapter pattern implementation:
class Stripe { public function capturePayment($amount) { /* Implementation... */ } public function authorizeOnlyPayment($amount) { /* Implementation... */ } public function cancelAmount($amount) { ...