A PHP7 Class Autoloader that is PSR-4 Compatible and universal in nature.
A PHP-7 Namespace/Class Autoloader shipped with the InfernoPHP Framework but compatible with any project.
The Autoload Class is in charge of exactly what its name describes, locating and autolading PHP Classes be it via. Namespace or by other means. Though Composer has a nifty Autoloader itself, it just doesn't do the trick when it comes to selection and capabilty; as such we have put one togehter.
This script is shipped in part or as a whole package with InfernoPHP, we have done our best to ensure that all libraries are able to be used outside of their purposed framework; however at the same time offer no warranty in the event something goes wrong.
We utilize Composer for Distribution of each of the libraries provided with InfernoPHP, therefore you will be required to have composer installed to be able to utilize this library. Click Here for directions on how to setup Composer in your environment. To install this library, use the following command:
$ composer require infernophp/autoloader:dev-master
As you may have noticed the reference to dev-master above; keep in mind that InfernoPHP is in active development right now and until an initial release is ready everything will be distributed from dev-master.
Before you can use this library, you will need to include the Composer Autoloader in your script, as it is required to access applications within. If you havent done so, include it by adding the following code to your PHP file (suggesting your file is in the same directory as vendor/)
; <?php ; require_once "vendor/autoload.php";
Once Composer has been added to your script, you can use the Autoloader as follows:
; $Autoloader = new \InfernoPHP\Autoloader();
; $Autoloader->addNamespace("Namespace\\Here", "/path/to/folder"); ; ; // Load Class within the Namespace ; $class = new Namespace\Here\Class();
To do this you will need to setup a Config File that contains the specified configurations. To define the path to your Config Directory have a Constant defined BEFORE you start the Autoloader:
; define('CONFIG_PATH', '/path/to/config/files');
As in the InfernoPHP Documentations, a lot of our libraries require that this folder be available and this constant be defined. In this folder you must create a config file, Autoloader.php; you can access a skeleton copy by Clicking Here.
- Method to add Classmap Namespaces
- Method to remove Classmap Namespaces
InfernoPHP is distributed under the MIT License
InfernoPHP is based off of CodeIgniter and as such may contain code or references to code that may be found in distributed copies of CodeIgniter. The reason that we chose to build InfernoPHP is that though an excellent framework, CodeIgniter has one restriction... Customization. CodeIgniter requires a skeleton directory structure that we weren't too fond of and lacked some features we felt should be present while working with larger scale projects.
Additional credit goes to Elixant Technology Ltd; the company responsible for InfernoPHP and its continued development. Elixant Technology built InfernoPHP for use in the development of their planned business management solution, Inferno Suite, which will compete such such software as WHM Complete Solution
InfernoPHP and all Components, Packages and Libraries are Copyright © 2014-2017 Elixant Technology ltd.