|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not enough user ratings||Total: 138 ||All time: 9,201 This week: 201|
This package can autoload classes based on PSR-4 recommendation.
There is an autoloader class that can load classes based on path of a specific directory that is associated to a given namespace.
It registers a given namespace and associate it to a given auto-loading directory. The class also registers sub-directories and associate them to sub-namespaces.
|PSR-4 is a recommendation by the FIG (Framework Interoperability Group) that defines how package classes should be automatically loaded according to given namespaces that are associated to certain directories.
This class extends the recommendations of PSR-4 by defining a class autoloader that not only associates a given directory to a certain namespace, but also associates sub-directories to sub-namespaces.
* Registers a new registrar for the autoloader, this file is part of Plug-Autoloader.
* @see ./autoloader.php For a description of what this project is all about
* and how it works.
* @author Samuel Adeshina <firstname.lastname@example.org>
* @version 1.0
* @since 0.0.1 1st January, 2016
* @copyright 2015 - 2016 Samuel Adeshina <email@example.com> <http://samshal.github.io>
* @license MIT
require __DIR__ . "/autoloader_register.php";
* We need to specify the location of the configuration file.
* It can be an xml or a json file and it can be located anywhere.
* @see AutoloadeRegister::ParseConfigFile() For a detailed explanation of this
* It is advised to set this location to the document root, that is the root level folder
* The default is the root level folder, but... feel free to change it to any other location as
* you see fit.
$base_directory_minus_file_name = $_SERVER["DOCUMENT_ROOT"]. DIRECTORY_SEPARATOR;
$config_file_name_minus_extension = "autoload";
if (file_exists($base_directory_minus_file_name. $config_file_name_minus_extension.".json"))
$configuration_file = $base_directory_minus_file_name. $config_file_name_minus_extension.".json";
else if (file_exists($base_directory_minus_file_name. $config_file_name_minus_extension.".xml"))
$configuration_file = $base_directory_minus_file_name. $config_file_name_minus_extension.".xml";
new Plug\Autoloader\AutoloaderRegister($configuration_file, $base_directory_minus_file_name);
A PSR4 Implementation of an autoloader for the ~Plug Microframework.
> The configuration file for this autoloader can be __supplied in two different formats__:
> It can be provided as a json file or as an xml file.
The Autoloader first checks for a json file before xml since thats the default config format.
You must create an xml autoload configuration file in the document root in order to use xml for the config format.
You can rename the autoload.xml.template file to autoload.xml after the autoload.json file has been deleted or renamed to
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.