PHP autoloading is a topic that, once you’ve begun to employ it in your projects, is hard to avoid doing so in any project moving forward.

The challenge with learning how to do it, though, is learning aspects of object-oriented programming and what facilities the PHP standard library has to offer. On top of that, there are other advanced tools like Composer that make it possible, as well.

You have to walk before you can run, as they say, so in a recent series on Tuts+, I walk through how to perform PHP autoloading using object-oriented programming in the context of WordPress.

PHP Autoloading in WordPress

This particular series is a follow-up to the Namespaces and Autoloading series that was published earlier this year. Since each of the concepts are related but can stand alone, I’ve broken them up into two different series.

PHP Autoloading in WordPress

At the outset of the series, I describe the set of three tutorials:

In this series, we’re going to take a look at exactly what PHP namespaces are, why they are beneficial, and how to use them. Then we’re going to take a look at how to use autoloaders to automatically load the files that we need without having to manually load them in our code.

The whole point of the series is to take a look at how to do something like this without using third-party tools so that when the time comes to use something more advanced, you have an idea as to how it works or the concepts behind it.

Additional, it helps to strengthen your object-oriented skills.

Regardless, if you’ve never used autoloading, I recommend checking it out. And if you’re familiar with object-oriented programming but aren’t familiar with what PHP or that things like this are possible (rather than manually including a bunch of files), then perhaps this will be useful reading.