Announcing Equip Framework

Last summer the development team at When I Work started to develop an open source framework that would be the basis for future projects and provide a migration path from our aging Kohana codebase to something more modern. Originally we called it Spark. While we liked the idea of "starting…

Dependency Inversion and PSR-7 Bodies

The last 72 hours have been interesting to say the least. My rebuttal to Anthony's post have lead to some very interesting conversations. Among these is Andrew Carter's post entitled PSR-7 Objects Are Not Immutable in which he details how an exception handler middleware can generate a bad response body,…

All About PSR-7 Middleware

On May 10th, 2016, I proposed an HTTP Middleware PSR to PHP FIG. Since then, there has been a significant amount of concern around one aspect of the proposal in particular, which Anthony Ferrara has summarized quite well in his blog post All About Middleware. Before we get too deep…

Standard Code Formatting with EditorConfig

EditorConfig is a very simple configuration file that can be used in any code base to define formatting expectations like spaces or tabs, size of tab, file ending newlines, etc. Installation First you will need the editorconfig binary. On a Mac with Homebrew, this is as simple as: brew install…

Better Commits with Static Review

One of the best changes that I have recently ever made to my workflow has been reading Chris Beams' excellent How to Write a Git Commit Message. If you haven't read it, you should go do it right now and come back once you are done. The Problem You're programming…

The Binary Classification of Objects

After working on immutable data structures and dependency injection with Auryn I often find myself questioning class constructor style when doing code reviews. Recently I was reviewing a pull request that had this signature in it: public function __construct( RequestInterface $request, DateTime $now, $key, $ttl, $algorithm = 'HS256' ) { ... } A Funny Smell…

Configuration in Spark

Building on my last post about dependency injection I thought it would useful to talk configuring Auryn within the context of Spark. Basic Configuration The default configuration of Spark is in web/index.php. If you were to add configuration for PDO the easiest thing to do would be: $injector…

Dependency Injection with Auryn

Dependency Inversion is Hard One of the hardest things to do properly when following SOLID principles is Dependency Inversion. I struggled to understand and implement this concept for years. Often I wondered if it was really worth the trouble to write all of that extra configuration just to simplify testing.…