Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 124 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

Namespaces in WordPress: File Organization

Those who have worked in object-oriented programming languages are likely familiar with namespacing and the benefits they provide when organizing a project. Unfortunately, namespaces in WordPress aren’t something that I’ve seen as much as in projects I’ve seen elsewhere.

Namespaces in WordPress: File Organization

And when I say “namespaces in WordPress,” I’m not talking about WordPress core. I’m talking about WordPress plugins. I think there are a variety of reasons developers don’t use namespaces (and may I’ll talk about those later); however, I’ve gotten curious about those who do use namespaces in their projects.

Specifically, I’ve been interested in the conventions that people follow, how they map their files to their namespaces, and so on.

Though there’s likely variation in some of the things we do, I think making sure our files map to a particular directory structure is helpful when dealing with projects (especially large projects).

Continue reading

Using Laravel Valet for WordPress Development

One of the latest options available for local development is using Laravel Valet for WordPress. This is now one of the options available for the already set of options we already have:

When it comes to having choices like this, it can make it difficult for a beginner to decide where to start. And as important as I think it is to explain the benefits of each of the above options, that post is not this post.

Instead, I want to share a short tutorial I wrote about using Laravel Valet for WordPress. Personally, I think Valet is a great solution for beginners, but it assumes a bit of familiarity with the command-line that might be off-putting to new users.

Once you setup the software, it’s hard to argue against using it. So with that said, here’s how you can get started.

Continue reading

Unit Test Existing Code in WordPress Projects

In following-up with yesterday’s post on unit testing WordPress code, I ended up wanting to say more than I did. There are are a lot of things to talk about (entire books cover TDD so what could a single post offer, anyway?).

Rather than try and tackle so many things in a handful of posts, I’ll stick with writing shorter posts on a handful of these topics.

Unit Test Existing Code (or Red-Green-Refactor)

Unit Test Existing Code (or Red-Green-Refactor)

One of the things that I wanted to discuss is the how unit testing can help drive architectural decisions. The challenge with the latter, though, is that part of writing tests often comes with retrofitting tests (or how we can unit test existing code).

And this is a topic all its own.

Continue reading

Architecture and Unit Testing WordPress Code

In a few recent projects, I’ve been unit testing WordPress code and doing more general test-driven development than normal. I’m no stranger to TDD, but it’s not something I am religious about using. For me, it depends on the nature of the project.

There’s a lot of writing on TDD and its advantages, and a lot of people who use it swear by it. It builds a level of quality into a project and helps with adding new features, solving bugs, and modularizing code.

Unit Testing WordPress

Unit testing WordPress code is a bit of a mixed bag, and it comes down to the fact that object-oriented code in WordPress is often tightly coupled to both the business logic and the WordPress API.

Since TDD can help designing the architecture of a project, it can help guide how we can create more testable classes.

Continue reading

How To Checkout WordPress via Subversion

If you want to contribute, you’re going to need to know how to use Subversion to checkout WordPress from its Subversion repository.

Before looking into how to do that, I’d say that source control is but one of the tools that a professional developer (let alone a WordPress developer) should have at his or her disposal.

So why not use this open source project to learn how to do just that?

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑