One of the easiest things that we can do when working on WordPress plugins is to drop require_once or include_once statements throughout our code.
And why not? It’s an easy way to bring in all of the necessary files or dependencies for a given class, have it easily readable, and not have to worry about creating huge files of code. That is, it helps us simplify what we’re writing so that we’re able to have our classes [mostly or ideally] do what they are doing well.
If you’ve read this site for the past year or so, though, you know that I’m a fan of autoloading and it’s something that I think anyone working with PHP – regardless of if you’re using WordPress or another platform – should use.
But it raises two questions especially if you’re just starting out:
- Why bother with autoloading when there are other ways to handle loading dependencies?
- How does autoloading stack up against compiled languages?
So I thought it would be worth answering this in the next couple of posts.

