Im trying to implement the PSR-0 autoloader found here : Autoloader
I have simply copied and pasted the code as it is shown in the link so should work out of the box. Here is my file structure for my App:
I believe i have set up the file structure correctly. App being the vendor, and then the folders below all being namespaces e.g. Frontend, Base, index will all be namespaces and subnamespaces.
The autoloader classes specifies this code in order the initiate the autoloader:
$classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
$classLoader->register();
And in my app i have used this:
$classLoader = new SplClassLoader('App', SITE_ROOT);
$classLoader->register();
The reason i have only put App as the namespace for the classLoader function is because i need to autoload all classes under the App folder.
Here is the initiation of my router class which i believe should be autoloaded so i don't have to include it:
$route = new router();
$route->setDefaultController(DEFAULT_CONTROLLER);
$route->setDefaultMethod(DEFAULT_METHOD);
$route->do_route();
$controller = $route->getController();
$method = $route->getMethod();
$arguments = $route->getArgs();
Is this correct? it doesnt seem to be loading any of the classes, not even the router class which is in the same directory as the autoloader?
Im getting pretty confused about what should be parsed to the SPLClassLoader function shown above for a namespace.
Any help in this area will be much appreciated
Thanks