johnwatkins0/wp-autoload

There is no license information available for the latest version (1.0.0) of this package.

Autoloader for WordPress classes, traits, and interfaces.

1.0.0 2019-01-13 22:02 UTC

This package is auto-updated.

Last update: 2024-04-11 14:06:28 UTC


README

Registers an SPL autoloader that loads classes, interfaces, and traits using WordPress file naming conventions.

Example

| functions.php
| inc
    class-my-class.php
    trait-my-trait.php
    interface-my-interface.php
<?php

namespace My_Namespace;

class My_Class implements My_Interface {
    use My_Trait;
}
// functions.php

register_wp_autoload( 'My_Namespace', __DIR__ . '/inc' );