Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 13 of 426)

Don’t Forget: Remember to Build Tools

As programmers, we’re used to leveraging all kinds of tools that help us to do our jobs be it something such as a debugger to something that helps us standardize our code to something that helps us to deploy our code to whatever platform we’re releasing our product.

And there seems to be a pattern that emerges for many of us as we work through our career:

  • We often try to write everything we can for ourselves (we have the time, energy, and desire to do so).
  • We start leveraging tools that helps us to achieve our primary goal (we have the know-how to use pre-existing, high quality utilities that help us to write better code or work with a larger project).
  • We develop a work flow for working in our niche and outsourcing all of the things that can be automated to third-party tools (we know what we need to focus on and leave the rest to other tools).

But do these tools that are part of our workflow always help us get our work done on a small scale? In other words, why don’t we remember to build tools for ourselves to use?

Continue reading

Effortless Documentation with Modern Tools

This is a long article on The Surprising Power of Documentation and I think it’s worth a read, but it’s also geared toward implementing a documentation-first mindset in an organization.

This isn’t something I’m concerned about focusing on in this post but there are a few points the articles are makes and it reminded of a few things that I’ve done over the few months – especially with the growth of tools such as GitHub Copilot Chat – to make the documentation process almost effortless.

Continue reading

Sodium Compat: PHP Sodium Functionality via Composer

If you’ve worked with PHP with any length of time and needed to use some type of built-in encryption, you’ve likely seen something about the Sodium library in the manual.

Sodium is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing and more. Its goal is to provide all of the core operations needed to build higher-level cryptographic tools.

Unfortunately, the module that contains this library isn’t always installed with the PHP binary. It then has to be either re-compiled or enabled by a package manager. If you don’t have the ability, time, or access to do any of those, then there’s a solid alternative for the native library that can be installed via Composer: Sodium Compat.

Continue reading

Living Deeply, Writing Broadly

Multiple times, I’ve drafted notes, written, and re-written parts of this post in an attempt to find the best way to start. And, I know, oftentimes writing qualifying statements or short paragraphs like this is considered something we shouldn’t do when publishing content.

But I don’t think I’ve the best track record of doing the things that I should be doing whenever writing on this site and I tend to write how I want, more often than not, about whatever it is I want to share.

Why buck the trend?

Continue reading

Quick Tip: Verify Minimum PHP Version

Assume that your plugin requires a minimum version of PHP and you want to prevent activation if the minimum PHP version isn’t met.

Add the following code after you’ve declared your namespace, checked to make sure the plugin isn’t being directly accessed and so on:

if (version_compare(PHP_VERSION, '7.4', '<')) {
    exit(
        sprintf(
            'The plugin requires PHP 7.4 or higher. Your WordPress site is using PHP %s.',
            PHP_VERSION
        )
    );
}

If the comparison fails, then an error message will be displayed on the plugin activation screen along with the string you’ve passed to the sprintf function.

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑