Tale Loader
A Tale Framework Component, (*1)
What is Tale Loader?
A PSR-4 and PSR-0 compatible loader without other dependencies, (*2)
Installation
Install via Composer, (*3)
composer require "talesoft/tale-loader:*"
composer install
Usage
Assuming the following structure:, (*4)
/library
/App.php
/App
/Middleware.php
/Db.php
/Db/Table.php
do, (*5)
use Tale\Loader;
$loader = new Loader(__DIR__.'/library');
$loader->register();
and you're done., (*6)
To disable the loader you can unregister it (which it will do automatically upon destruction), (*7)
$loader->unregister();
If you want to map a namespace on your directory, use the second argument, (*8)
$loader = new Loader(__DIR__.'/vendor/my/app', 'My\\App\\');
If your files are named differently, use the third parameter, (*9)
$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., (*10)