A simple PHP class for PHP class autoloading based on classes namespaces.
Add a dependency on andou/autoloader
to your project's composer.json
file if you use Composer to manage the dependencies of your project.
You have to also add the relative repository.
Here is a minimal example of a composer.json
file that just defines a dependency on andou/autoloader
:
{
"require": {
"andou/autoloader": "*"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/andou/autoloader.git"
}
],
}
You can use this autoloading class in your project simply specifying the path from which the Autoloader should fetch for classes
require_once './vendor/autoload.php';
new Andou\Autoloader(__DIR__ . "/path/to/your/classes");