Using Modern PHP with WordPress: Part 1 – Photogramappy

This series of articles is meant to demonstrate how to use Modern PHP approaches, technologies, and best practices in parallel with WordPress. WordPress, to its credit, is beginning to push adoption of PHP 7 and will require it by the end of 2019. That is a massive move, but I recommend PHP 7.2 at a minimum. PHP 7 has reached its End of Life (EOL).

Over the past few years, I have worked with WordPress in a modern way. Approaches to Dependency Injection, Composer-driven projects, and containerization is all part of what has made my best WordPress development life this one.

I wrote a simple plugin that I affectionately have called – but granted, annoying to spell – Photogramappy. The idea is built on a personal project idea I had several years ago.

You see, I live in Baltimore and it gets a bad rep. From crime to decidedly smaller, and more quaint than neighboring Washington, D.C., many perceive it through the ideas of The Wire. Fun fact: Baltimoreans, generally, despise outsiders comparing the city to The Wire.

I digress.

The project was simple, yet turned out to be difficult. Baltimore is a lot like Chicago in the sense that all the action happens out in the neighborhoods, and not downtown. There are over 250 neighborhoods in this small city, known as Charm City. Each has a different sense of self, different cultures, traditions, experiences. I very simply wanted to photograph something unique about each of the neighborhoods as an art project. I wanted to map the location of each photo from each neighborhood, write a small story about the context and map it on a website.

This project never came to fruition, but I decided to revisit the plugin I had initially wrote, and reinvent it in Modern PHP.

I’ve been frustrated by development techniques in the more traditional WordPress world, and the hesitancy of developers to adopt modern PHP as a minimal viable entry point to plugin development.

It requires PHP 7.2, WordPress 4.9.9+, and Composer. For the testing suite, it requires Codeception, Selenium standalone server, OpenJDK, and ChromeDriver.

If you are intrigued by this, please talk to me about how I can help your organization. In Part 2, we will dive into dependency injection and containers.

  • Category: PHP