A small and lightweight PSR-4 and PSR-0 compatible loader

0.1 2016-03-01 19:04 UTC

This package is auto-updated.

Last update: 2023-01-10 04:24:38 UTC


A Tale Framework Component

What is Tale Loader?

A PSR-4 and PSR-0 compatible loader without other dependencies


Install via Composer

composer require "talesoft/tale-loader:*"
composer install


Assuming the following structure:



use Tale\Loader;

$loader = new Loader(__DIR__.'/library');

and you're done.

To disable the loader you can unregister it (which it will do automatically upon destruction)


If you want to map a namespace on your directory, use the second argument

$loader = new Loader(__DIR__.'/vendor/my/app', 'My\\App\\');

If your files are named differently, use the third parameter

$loader = new Loader(__DIR__.'/lib', 'My\\', '%s.class.php');

That's all it can do any probably ever will. Maybe optional class maps will be implemented.