Software Engineering in WordPress, PHP, and Backend Development

Tag: PHP (Page 4 of 12)

A Beginner’s Guide to Querying the Slack API

Creating Slack applications can be as time-consuming and complex as writing any other type of application. What if you’re interested in querying the Slack API for your workspace and incorporating the results in a WordPress plugin? Here’s how you can get started.


Ultimately, all we need to make queries to the Web API is an OAuth token and a REST API client to make requests. From there, it’s a matter of programmatically implementing the functionality in your code.

But that’s not at what we’re aiming. Instead, this article is more about learning how to make requests to the Slack API and what’s required to get set up to do so.

Continue reading

How to Dynamically Load Classes by Namespace in PHP

TL;DR: To dynamically load classes by namespaces in PHP, you need a Registry, and a way to parse the concrete files from a directory based on its namespace.


Whenever I’m working on a project that has an object-oriented code base and that uses Subscribers and Services, I often use a Registry. This makes it easy to

  • register the subscribers with the core application whenever the code runs,
  • de-couple any Service classes so they can be tested or even run isolation,
  • and maintain the code base whenever something has to be added or taken away.

One challenge with this approach though, at least in PHP, is that I’ve found myself having to go back into the Registry and set a reference to a given Subscriber whenever I want to add it (or remove it whenever I want to, you know, remove it).

Ideally, I want my registry to know where the subscribers are and how to set them up. This way, I can focus on working on the rest of the code.

Continue reading

Using PHP Sniffer & Beautifier for Visual Studio Code

TL;DR: There are a few PHP Code Sniffer extensions for Visual Studio Code. The one I prefer is PHP Sniffer & Beautifier by Samuel Hilson. Here’s where to get it and how to configure it.


Though this isn’t directly related to the material I’m writing about in my series on Ray on WordPress, it’s relevant enough to share at this point because:

  • the series is only going to include more code and i use this extension for writing said code,
  • over the last few months, I’ve found this extension to be really good in comparison to others that are available.

There are some other ones out that that are really good, and I’ve used them, but this is the one I’ve settled on using.

Continue reading

Installing, Configuring, and Setting Up Xdebug in Visual Studio Code

TL;DR: This is everything that needs to be done to install Xdebug with a Homebrew-based environment and to work with the software within Visual Studio Code.


Though I’ve recently become a fan of using Ray (1, 2) for much of my lightweight debugging, this doesn’t mean I don’t think it’s important to have Xdebug installed and configured in Visual Studio Code.

If you follow the steps I’ve outlined starting in the previous post, it’s relatively easy though it still requires a little bit of manual work to get started.

This is how you can set up Xdebug with a Homebrew-based configuration and Visual Studio Code.

Continue reading

Installing PHP 7.4 and PHP Monitor for WordPress Development

TL;DR: How to uninstall PHP 8.1, install PHP 7.4, why you should do so, and one extra utility to helps manage PHP packages and modules.


When I wrote about how to fix WordPress, PHP, MariaDB, and Homebrew, I didn’t cover some of the other larger issues that I experienced when working backwards into the solution.

I need to give Ihor a hat tip here because he and I spoke about this more on Twitter regarding the relationship between WordPress, PHP 7.4, 8.0, and 8.1.

I’d be remiss if I didn’t clarify the following:

  1. I was running PHP 8.1.
  2. WordPress is not compatible with PHP 8.1
  3. WordPress is [allegedly] compatible with PHP 8.0 but I’ve not tested it or my tools against this version because I wanted to have full compatibility.
  4. I downgraded my system to PHP 7.4.27 until I get my entire set up configured as I like. Then I’ll start upgrading components.

So if you’ve followed the aforementioned post, here’s a more complete set of things I’ve set up to make sure everything is working well together – including things I’m working on writing about 🙂.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑