A trait is a mechanism for reusing code across multiple classes that aren't related by inheritance. Since PHP only allows single inheritance, traits provide a way to share methods (and properties) horizontally — a form of "compositional" code reuse, like mixins.
The problem traits solve
PHP has single inheritance — a class can extend only ONE parent. But you often want
to share the SAME methods across unrelated classes (e.g. logging, timestamps).
Duplicating the code is bad; traits let you reuse it without inheritance.
