Traits with interfaces

In PHP, Traits can't implement interfaces. They can, however, include abstract methods. These methods then need to be implemented by the concrete class that implements the trait. This allows a traid to provide some boilerplate implementation that depends on an concrete implementation. This isn't always a good idea (it's verging on violating the Dependency Inversion Principal but it's better than a trait attempting to use a method that has no contract.

»
Author's profile picture Dave Hulbert on design and php

Singletons: bad. Shared resources in a DIC: good.

Singletons

»
Author's profile picture Dave Hulbert on design, php, and solid

Should I use global variables?

Someone posted a question about using global variables on r/php, which I answered. Copied here for posterity.

»
Author's profile picture Dave Hulbert on design, php, and solid

Notes on designing through mocking

My notes on Everzet's talk "Design how your objects talk through mocking" at PHPNW14

»
Author's profile picture Dave Hulbert on design and php