Latest blog posts

Simplify Project On-boarding with Laravel Homestead

Despite working on Liquid Web’s Managed WordPress and Managed WooCommerce hosting products, a fair amount of the development work I do these days has very little to do with WordPress. In fact, my main project right now is using Laravel, and it’s the sixth Laravel application (depending on how you count projects) I’ve worked on in just under two years at the company.

Laravel’s an incredibly powerful application framework with a thriving ecosystem. Thanks to tools like Composer and Packagist, I have access to thousands of libraries, extensions, and utilities to help me build the best applications possible. Even out of the box, the framework has support for (among many other things) multiple database and caching engines, event-driven architecture, and websockets, giving me a strong foundation for building modern web applications.

Of course, incorporating multiple platforms and tools into a single application can make on-boarding new team members more difficult. How do you make sure they’re running the right versions of PHP, your RDBMS of choice, Redis, and more?

Automatic, Whole-Home Time Machine Backups

Over the holidays, I decided to tackle a problem that’s been on the back-burner for a while: how can my wife and I automatically back up our Macs to a common Time Machine drive? We already have a router I’m happy with (the NETGEAR R6400, which is a couple years old now), so I didn’t want to replace a solid router with Apple’s Time Capsule, especially given that the line seems to have been discontinued. Is there a way to keep a common Time Machine drive on the network?

Up until this point, Kim and I have gotten by with our own Time Machine disks that live on our desks: when we’d remember, we’d plug in the disks and ensure a backup was made. I can’t speak for Kim, but I know my backup history was…spotty, to say the least.

When Kim started her own business in 2017, we upgraded her older MacBook Pro with a new SSD and kept the old drive housed where the rarely-used optical drive used to live. All told, she has just shy of a terabyte of storage on her machine, but was (just barely) backing up to a 500GB Time Machine disk. Wanting to ensure that client files and portfolio pieces alike were backed up securely, Kim asked if I could set something up to make the process easier; this is what I found.

Atomic Deployments from Scratch

Years ago, a mentor of mine introduced me to a Ruby-based server automation tool called Capistrano, and I immediately fell in love. Ready to deploy a new release? Rungit push && cap production deploy, then you’re done. Even better, Capistrano introduced me to what’s colloquially known as “atomic deployments” — checking out a full copy of the codebase and using symlinks to point to the new release for a zero-downtime deployment — which has since been my gold standard for deployment methods.

I continued to use Capistrano for a few years, until I started working on projects (and teams) large enough to justify a proper continuous delivery (CD) tool. Suddenly, building the application locally and pushing up with Capistrano became more complicated; at the same time, services like DeployBot began offering atomic deployments right out of the box, so it was easy to get up and running.

What about services that don’t offer atomic deployments as a default? I recently deployed a Laravel application via Codeship, where atomic deployments to a VPS becomes more complicated; here’s how I approached it:

Routing phone calls to volunteers with Twilio

In the past week or so, I’ve been working on a Laravel application that enables groups of volunteers to be added to a call tree; a phone number comes in, then gets routed to one of the active volunteers’ phone. A lot of the core functionality is there, but the app isn’t quite ready to release to the general public. There’s something of a time-crunch, however, as the main reason for building the application is to connect people who need rides to their polling places with volunteers in the days leading up to the critical 2018 midterm elections.

Here’s the concept: someone in need of a ride calls a Twilio number, which then rings up to ten (10) volunteers’ phones. Whomever picks up first gets the call, and they can work through arranging transportation.

Building the application has been an awesome introduction to telephony service providers like Twilio, which combine voice and SMS messaging with web applications. Using Twilio’s TwiML (Twilio Markup Language), I can write simple XML documents to describe how to respond to different messages. I have a lot of features planned as far as routing calls more intelligently and letting volunteers mark themselves as unavailable, but I wanted to get the bare-bones TwiML out to the public as far ahead of Election Day as possible.

Understanding the functions.php file in WordPress

AIf you’re just getting started with WordPress, there’s likely a lot of new terminology being thrown at you. Beyond fundamentals like “themes” and “plugins”, you’re probably seeing “actions”, “filters”, and a ton of code snippets with instructions like “just add this snippet to your functions.php file.”

Let’s take a step back and look at WordPress’ functions.php file; what it is, where it lives, and how it works. Once we understand those points, we’ll learn how to add snippets to our WordPress sites without having them accidentally overwritten.

Streamlining your test suite with PHPUnit Data Providers

In every testing talk I’ve attended (or given), there’s one stand-out feature that often has the audience saying “whoa, I had no idea you could do that!” No, it’s sadly not “hey look, you can reliably build quality software with a much lower chance of defects or regressions!”, but rather the inevitable use of PHPUnit’s Data Providers.

With Data Providers, our test suite can become more readable and maintainable while making it trivial to add new testing scenarios. Best of all? PHPUnit ships with Data Providers right out of the box.

Improvising a vacation coffee dripper

Last week, my wife, daughter, in-laws, and I took a week long vacation to the west coast of Michigan. Bookended by two weekends in Grand Rapids (the second of which was centered around WordCamp Grand Rapids), we rented a cottage in Spring Lake, just outside Grand Haven, MI.

The trip started off well enough (I should mention that my in-laws and I get along well, and my father-in-law joined me a couple of years ago on my walk across Columbus), but things got rough once we arrived at the cottage. No, it wasn’t family drama, nor was the toddler to blame (though her “terrible twos” aren’t helping) — the coffee pot in the cottage was on its last leg.

The first morning, the coffee was…okay. I had brought some beans from Upper Cup Coffee (one of my hometown favorites), but the coffee pot had obviously not been well-maintained. The coffee maker itself took about 30min to brew a 12 cup pot (which is way too damn long!), and when we tried to make a second pot the coffee maker decided it’d had enough: the heating element stopped working, and no heat means no hot coffee (and a severe lack of cognitive function on my part).

Automatically Install PHP’s Runkit7 via Composer

A WordPress plugin I’ve been working on recently needed to be able to accept configuration in a few different ways: users should be able to define a constant in the wp-config.php file or fill out a form within a settings screen. If the constant is defined, the setting screen should be aware of that and hide the setting, since the constant should take precedence.

This is a pretty common pattern in WordPress plugins, but it can get rather tricky to test; by design, once a constant is defined in PHP, you shouldn’t be able to change its value. PHPUnit has ways to work around this by running tests that define constants in separate processes, but this can seriously impact the performance of your test suite. Furthermore, the WordPress core test suite is pretty tightly coupled, so it doesn’t like when tests are run separately.