PHP Traits: How to Use Them the Right Way
There are many ways to stop code duplication in classes. The simplest way is inheritance. But what if a class needs code from many different classes? PHP does not allow multiple inheritance. So the only way is to use traits. A good trait works well in any class. This post shows you how to write a good trait.