WordPress AutoLoader Plugin

Source URL: WPAL GitHub repo
Technologies:

An autoloader lets you dynamically require or include a file based on it’s class name. When using object-oriented programming, autoloading classes makes it easier to manage your code. However, WordPress doesn’t currently have an autoloader. So I created the WPAL (WordPress AutoLoader) plugin to address this issue.

How does it work?

The WPAL is written as a must-use plugin. As a result, it is loaded before the regular plugins, and it can’t be deactivated accidentally. Once installed, you only need to add a small snippet of code to your plugin or theme.¬† It registers a function, which points to a directory within your plugin or theme. This directory will contain your OO classes and match the structure of your namespaces.

What are the benefits?

The main reason I created the WPAL, is so plugin and theme authors could use it to manage their own classes. My hope is this help WordPress developers adopt the modern development practices of their fellow PHP developers. Ultimately this should result in better quality code in the theme and plugin ecosystems.

The WordPress AutoLoader plugin code is available on my github and is available for download.

I’d like to get some feedback on it, so I can improve it.