Simple autoloader that will autoload classes, interfaces or traits with namespace prefix
composer require frozzare/wp-autoload
Example of your main php file.
require 'vendor/autoload.php';
register_wp_autoload( 'Example\\', __DIR__ . '/src' );
Example of src/class-plugin-loader.php
namespace Example;
class Plugin_Loader {}
Example of src/trait-crawler.php
namespace Example;
trait Crawler {}
Example of src/interface-say.php
namespace Example;
interface Say {}
MIT © Fredrik Forsmo