Decorator pattern in PHP

The decorator pattern is another structural pattern. The aim of the decorator pattern is to extend an existing classes functionality without modifying existing classes and rather using composition to wrap and extend the existing functionality.

Using Decorators, existing behaviours will stay the same, but you will have additional behaviour extensions which can be used to modify the output.

Continue reading