Plugin: See in REST API
I just set up the See in REST API repository on GitHub, a simple WordPress plugin that adds a new node to the WordPress admin bar, which links to the REST API representation of the current resource. This works both in the WordPress admin and on the front end (if you are logged in and […]
PHIVE: The Phar Installation and Verification Environment
In this post, I would like to give a quick summary of the PHIVE tool, what it allows to do, and invite you all to trial and discuss this. Maybe it will be useful for you to adopt. Manage Local PHP Tooling The idea behind PHIVE is to provide an optimized and streamlined way for […]
WP-CLI Command to Manage Orphan Data and Metadata
Last week, when I was in between projects, I decided to take one day and draft up a WP-CLI command that allows for listing and deleting orphan WordPress entities, as well as metadata. I had the idea for this quite a while ago, and I tried to get it into WP-CLI. That failed, however, as […]
Quickly Display All Diffs in a GitHub PR
So, you have to review a pull request with quite a few files? And several of them are quite large? Or there are several deleted files that you want to review? There are reasons why GitHub does not load a diff, for example, because it’s too large, or because it’s for a file that has […]
What Version of Gutenberg Is in WordPress XYZ?
The WordPress Block Editor, which is a part of Core WordPress, is being built in the form of the Gutenberg (plugin) project, which again is split into various npm packages. Oftentimes, one would like to know “What version of Gutenberg is in a given version of WordPress?”. However, most of the time, the answer is […]
Stop and (Help) Fix It
A little over two years ago, I stumbled over a blog post that I resonated quite well with. It’s called Go see. Stop and fix it., and it’s by Leon Tranter, a certified Professional Scrum Master from Sydney, blogging about all things Agile. The blog post covers two concepts of Lean Software Development, which is […]
How to (Force) Update Your composer.lock
When using Composer, you might know that you should almost always include the composer.lock file in VCS. Now, the lock file includes a hash, which is generated from the contents of the composer.json file, and more. Therefore, changing something in this file, for example, the description, or something in the extra or config sections, will […]
Proper File Checking in PHP
TL;DR: if you want to read a file, use is_readable, not file_exists. Over the last year or so, I think I reviewed about a dozen PRs—both Human Made and external—with something like this PHP code snippet: While this code works like 99% of the time, it’s not really doing what people thought it did. What […]
Making the Best of PHPUnit Data Providers
When writing unit or integration tests for PHP, occasionally you need to test a specific scenario multiple times, with different input data. To make this easy and less repetitive, PHPUnit provides what is called Data Providers. A data provider is a method in some test case file, providing several sets of input data for one […]
Mapping Data and Behavior
Oftentimes, when writing software, we need to realize processes like this: “If A, then do B, otherwise do C.”, or that: “If A, then set X to B, otherwise set X to C.”. And there are also the more complex ones: “If A is equal to B, do X. If A is equal to C, […]