alleyinteractive / wordpress-autoloader
Autoload files using WordPress File Conventions
Package info
github.com/alleyinteractive/wordpress-autoloader
pkg:composer/alleyinteractive/wordpress-autoloader
v1.3.0
2026-10-30 20:23 UTC
Requires
- php: ^8.3
Requires (Dev)
- phpstan/phpstan: ^2.1.22
- phpunit/phpunit: ^12.5
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A PHP Autoloader that supports the WordPress Coding Standards. For example, a folder that looks like this would be autoloaded as:
src/class-example-class.php -> Root_Namespace\Example_Class
src/trait-reusable-feature.php -> Root_Namespace\Reusable_Feature
src/feature/class-example-feature.php -> Root_Namespace\Feature\Example_Feature
Supports class, trait, interface, and enum files and any level of
namespaces.
Installation
You can install the package via composer:
composer require alleyinteractive/wordpress-autoloader
Usage
Alley_Interactive\Autoloader\Autoloader::generate( 'Plugin\\Namespace', __DIR__ . '/src', )->register(); // Or register the autoloader manually. spl_autoload_register( Alley_Interactive\Autoloader\Autoloader::generate( 'Plugin\\Namespace', __DIR__ . '/src', ) );
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.