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.
Like anything, there’s a million ways to skin the Puppet cat. I’ve been moving all my RDL code over to Hiera through the magic of hiera_include and my own little addition hiera_declare_types. Things were going great until I realized the single inheritance model is limited in nature. Not only that, but some fellow Puppet folks who are more experienced than I pointed me to the concept of Roles and Profiles in Puppet. I was stumped for a bit, but now I’ve found my way through the maze and want to share my findings.