talesoft / tale-loader
A small and lightweight PSR-4 and PSR-0 compatible loader
Installs: 60
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/talesoft/tale-loader
Requires
- php: >=5.5.0
This package is auto-updated.
Last update: 2025-09-10 10:19:37 UTC
README
A Tale Framework Component
What is Tale Loader?
A PSR-4 and PSR-0 compatible loader without other dependencies
Installation
Install via Composer
composer require "talesoft/tale-loader:*"
composer install
Usage
Assuming the following structure:
/library
/App.php
/App
/Middleware.php
/Db.php
/Db/Table.php
do
use Tale\Loader; $loader = new Loader(__DIR__.'/library'); $loader->register();
and you're done.
To disable the loader you can unregister it (which it will do automatically upon destruction)
$loader->unregister();
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.