Quickshiftin - Clever Crazy Code

PHP traits in the real world

November 29th, 2014

I started dabbling with traits in PHP back when they were under development in 2010. It’s a little surprising then that I’ve just barely come round to actually using them in a project. Seems like PHP 5.3 has been so solid there’s been little need to upgrade, now I’m making the jump from 5.3 straight to 5.5 on a lot of my servers. Anyway, now that I’m rolling out servers with PHP 5.5 traits are on the table. Rather than regurgitating some Hello World example, I’ll illustrate a practial example from my new Softwear codebase and show how traits can save us from carpel tunnel syndrome we contracted before their advent.

More »