https://github.com/wpup/autoload
:train2: Simple WordPress autoloader that will autoload classes or traits with namespace prefix
https://github.com/wpup/autoload
Last synced: 9 months ago
JSON representation
:train2: Simple WordPress autoloader that will autoload classes or traits with namespace prefix
- Host: GitHub
- URL: https://github.com/wpup/autoload
- Owner: wpup
- License: mit
- Created: 2015-04-16T06:57:34.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T14:21:50.000Z (over 6 years ago)
- Last Synced: 2025-07-29T09:29:56.806Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 14
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Autoload
[](https://travis-ci.org/wpup/autoload)
[](http://unmaintained.tech/)
Simple autoloader that will autoload classes, interfaces or traits with namespace prefix
# Install
```
composer require frozzare/wp-autoload
```
## Example
Example of your main php file.
```php
require 'vendor/autoload.php';
register_wp_autoload( 'Example\\', __DIR__ . '/src' );
```
Example of `src/class-plugin-loader.php`
```php
namespace Example;
class Plugin_Loader {}
```
Example of `src/trait-crawler.php`
```php
namespace Example;
trait Crawler {}
```
Example of `src/interface-say.php`
```php
namespace Example;
interface Say {}
```
## License
MIT © [Fredrik Forsmo](https://github.com/frozzare)