Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 33 of 427

Building Backcast, Part 3

TL;DR: In this post, I cover PHPUnit, PHP, phpunit.xml, unit testing, and macOS and how to get them all to work together despite what ships with macOS.


In the initial draft of this post, I wrote about how I was going to start writing unit tests for small pieces of functionality as well as show exactly what functionality I was writing (and the why behind it).

But this took a weird turn that that led me on a long digression into three things:

  1. PHPUnit 9,
  2. the version of PHP that ships with macOS,
  3. And how to get them to work together nicely.

So rather than try to cover all of that in a single post, I thought it better to talk about PHPUnit, PHP, phpunit.xml, and macOS in a single post, then get back to to the practical work of building the project.

Continue reading

Building Backcast, Part 2

TL;DR: After thinking through what it might be like to build something like this over the next few-however-long-it-takes, publishing a podcast on something like this seems like a fun and logical thing to do especially since this whole project is about podcasts.

But this won’t be in the traditional sense of podcasts. Instead, I’m particularly interested in what Castos is doing with private podcasts.

Continue reading

Building Backcast, Part 1

TL;DR: I listen to quite a few podcasts and want to make sure that I’m backing them up for posterity. There are apps for this, yes, but I’m a fan of reading how other developers work on their projects. I’ve never written about building something from the ground up. It’s personally edifying and it helps others who are also building things, as well.

This is the first post in a series in which I will talk about building a small application (that will eventually be a WordPress plugin) for backing up podcasts as provided by an XML export from Overcast.


This may be a painful read for some who are experienced developers (so maybe don’t read it). Or maybe it won’t be. But one of the things I recently heard, in a podcast no less, sums up both the point of this project and the project I’m working on:

[the podcaster] simply created a type of show he wanted to hear and hope others shared his taste and a similar desire. 

I, like many of you, am a fan of listening to podcasts and do so for a significant amount of time during my week. My favorite podcast application is Overcast which provides an XML export of all of the podcasts to which I’m subscribed and to the episodes of each podcast.

For a long time (as in over a year which, given last year, has felt like a long time), I’ve wanted to work on an application for backing up my podcasts with the ultimate goal of turning it into a WordPress plugin.

But then I had the idea that maybe I’d start from scratch. And I don’t mean “software developer scratch.” I mean starting from nothing.

  • No web server,
  • No database,
  • No libraries,
  • Just an IDE and PHP,
  • And then I’ll go from there.

Like anyone, the time to work on stuff like this is limited, but this is something I want to build for myself. And given that I like to read other people’s experience with doing this kind of stuff, I’m going to share the process from beginning to end.

I hope to document all of the little problems, frustrations, idiosyncrasies, good ideas, bad ideas, and random thing that go throughout the process of putting this thing together.

So if that sounds like something interesting, then feel free to continue reading.

Continue reading

Writing PHP Command-Line Applications: Command-Line Arguments

TL;DR: $argv is an array of arguments passed to the script with the first index being the name of the script itself. And $argc is the number of arguments passed to the the script (which will always at least be 1).


Arguably, pun intended, one of the key pieces of command-line application is making sure that they are interactive through command-line arguments. In PHP, there are two variables to understand:

  • $argc is the number of arguments passed to script. Note the script’s filename is always passed as an argument to the script, therefore the minimum value of $argc is 1.
  • $argv is an array of arguments passed to script. Note the first argument $argv[0] is always the name that was used to run the script.
Continue reading

Writing PHP Command-Line Applications: A Basic Script

TL;DR: I’ve been writing PHP command-line scripts to help automate mundane tasks. As these tasks are growing in complexity or turning more into applications that interface with third-party APIs, I’m documenting the things I find important that others may also find helpful.


There are three things necessary to get a basic script up and running on your local machine (assuming you already have PHP installed):

  1. Know the path to the PHP binary,
  2. Make sure your script references said binary,
  3. And make the script executable.
Continue reading
« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑