An even more in depth article can be found here on WPKrauts.
EDIT The obviously correct way is to use namespace
d code, prepared for PSR-4 autoloading by putting everything in the appropriate directory that already is defined via the namespace. Then just use Composer and a composer.json
to manage your dependencies and let it auto-build your PHP autoloader (that imports automatically a file by just calling use \<namespace>\ClassName
). That's the de-facto standard in the PHP world, the easiest way to go and even more pre-automated and simplified by WP Starter.