Latest Posts

Expressive Tests with the Builder Pattern

I’ve been experimenting with techniques to keep my tests clean and expressive. One that I particularly like is using builders to create my system under test eg the object being tested and its dependencies. I’ll describe how I use this … Continued

Named Constructors in PHP

The named constructor pattern lets you to have multiple means of instantiating an object in a semantic manner. Aside from the added readability, this pattern can also compensate for PHP’s lack of method overloading. A Value Object Example We’ll start … Continued

Console Output with Generators

A problem I’ve found with command line applications is that you often find you want to output messages to the console at various points during the application’s execution. However, if and when these messages are to be output is generally … Continued

Have You Tested the Contract?

I’ve been grappling with the concept of contract testing over the past couple of months. I think they can offer me the confidence in my tests that I never really felt with integration tests (any of which was demolished when … Continued

Directory Structure with Multiple Vendor Directories

Package managers are quite useful fucking awesome. However, I’ve started to notice that building any serious application with just a single vendor directory is becoming a rare thing. My usual workflow for a PHP web app these days involves Composer, … Continued

Response Objects for File Downloads

Update September 5: I’ve released a basic package based on the subject of this post. It is not an uncommon requirement in a PHP web application to send files to the browser instead of web pages. You’ve likely, in the … Continued

Quick & Dirty Multi-Environment WordPress Setup

WordPress is not a nice piece of software to work with. Especially if you need to deploy it in multiple environments. There are a couple of ways around this. The Bedrock stack that the Roots team have been working on … Continued