Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/windwalker-io/loader

[READ ONLY] Classes loader to support PSR-0 and PSR-4 standards.
https://github.com/windwalker-io/loader

class-loader classloader php psr-1 psr-4

Last synced: about 1 month ago
JSON representation

[READ ONLY] Classes loader to support PSR-0 and PSR-4 standards.

Awesome Lists containing this project

README

        

# Windwalker Loader

Windwalker Loader is a simple, easy using class loader, support PSR-0, PSR-4 and class mapping autoload.

## Installation via Composer

Add this to the require block in your `composer.json`.

``` json
{
"require": {
"windwalker/loader": "~3.0"
}
}
```

## Usage

``` php
use Windwalker\Loader\ClassLoader;

$loader = new ClassLoader;

// Register autoload first
$loader->register();

$loader->addPsr0('Windwalker', __DIR__ . '/../src');

$loader->addPsr4('Windwalker\\Core\\', __DIR__ . '/core/src');

$loader->addMap('Windwalker\\Cache\\Cache', __DIR__ . '/../src/Cache/Cache.php');

// Just use your class, it will autoload
$cache = new \Windwalker\Cache\Cache;
```

## Autoload Standard

- [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
- [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)