[Solved] PHP autoload classes from different directories


You can add the other directories to the include path and if the class files have the same extension as your existing class files, your autoloader will find them

Before calling Autoloader:init(), do:

//directories you want the autoloader to search through
$newDirectories = ['/path/to/a', '/path/to/b'];
$path = get_include_path().PATH_SEPARATOR;
$path .= implode(PATH_SEPARATOR, $newDirectories);
set_include_path($path)

solved PHP autoload classes from different directories