Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alleyinteractive/wordpress-autoloader
WordPress autoloader that follows WordPress coding standards
https://github.com/alleyinteractive/wordpress-autoloader
wordpress
Last synced: 3 months ago
JSON representation
WordPress autoloader that follows WordPress coding standards
- Host: GitHub
- URL: https://github.com/alleyinteractive/wordpress-autoloader
- Owner: alleyinteractive
- Created: 2022-02-01T21:02:09.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T13:46:42.000Z (7 months ago)
- Last Synced: 2024-09-30T12:42:45.712Z (4 months ago)
- Topics: wordpress
- Language: PHP
- Homepage:
- Size: 79.1 KB
- Stars: 7
- Watchers: 28
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# WordPress Autoloader
[![Latest Version on Packagist](https://img.shields.io/packagist/v/alleyinteractive/wordpress-autoloader.svg?style=flat-square)](https://packagist.org/packages/alleyinteractive/wordpress-autoloader)
[![Tests](https://github.com/alleyinteractive/wordpress-autoloader/actions/workflows/tests.yml/badge.svg)](https://github.com/alleyinteractive/wordpress-autoloader/actions/workflows/tests.yml)A PHP Autoloader that supports the [WordPress Coding
Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/). 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_Namesace\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:
```bash
composer require alleyinteractive/wordpress-autoloader
```## Usage
```php
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
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.