concept composition in category php
appears as: composition

This is an excerpt from Manning's book PHP in Action: Objects, Design, Agility.
We have studied some of the ins and outs of inheritance. The alternative is object composition. Before moving on to interfaces and the idea of favoring composition over inheritance, we will take a look at how object composition works.
When the Gang of Four tell us to favor object composition over class inheritance, they point out that inheritance and composition are alternative ways to solve the same problems. There is nothing you can do with inheritance that you can’t do with composition, and frequently the result is more flexible and more logical. The main advantage of using inheritance is simplicity and convenience—in some situations.