PHP Traits – why is it useful

I know I’m late into the game but I recently found that Traits in PHP is really useful. PHP Traits come in handy if you have some part of a class you wish to re-use in the future in another class, but you don’t want strict inheritance relationship.

What is Traits

PHP Trait defines a code segment that is simply copy-n-pasted into a class at compile time. It can contains variables, constants, methods, Continue reading “PHP Traits – why is it useful”