FyreLoader is a free, open-source autoloader library for PHP.
Using Composer
composer require fyre/loader
In PHP:
use Fyre\Loader\Loader;
Add Class Map
Add a class map.
$classMap
is an array containing the class map.
Loader::addClassMap($classMap);
Add Namespaces
Add namespaces.
$namespaces
is an array containing the namespaces where the key is the namespace prefix and the value is the path.
Loader::addNamespaces($namespaces);
Clear
Clear the auto loader.
Loader::clear();
Get Class Map
Get the class map.
$classMap = Loader::getClassMap();
Get Namespace
Get a namespace.
$prefix
is a string representing the namespace prefix.
$paths = Loader::getNamespace($prefix);
Get Namespace Paths
Get all paths for a namespace.
$prefix
is a string representing the namespace prefix.
$paths = Loader::getNamespacePaths($prefix);
Get Namespaces
Get the namespaces.
$namespaces = Loader::getNamespaces();
Has Namespace
Check if a namespace exists.
$prefix
is a string representing the namespace prefix.
$hasNamespace = Loader::hasNamespace($prefix);
Load Composer
Load composer.
$composerPath
is a string representing the composer autoload path.
Loader::loadComposer($composerPath);
Register
Register the autoloader.
Loader::register();
Remove Class
Remove a class.
$className
is a string representing the class name.
$removed = Loader::removeClass($className);
Remove Namespace
Remove a namespace.
$prefix
is a string representing the namespace prefix.
$removed = Loader::removeNamespace($prefix);
Unregister
Unregister the autoloader.
Loader::unregister();