I've been playing a bit with the Symfony class loader (read about others, the concept and started implementing).
I've read http://symfony.com/doc/current/components/class_loader.html as well I've changed the directories structure to fit and all. Here's a small source-code which fails:
Filename: test.php , dir: C:/test/BE/src/main.php
<?php
define('BASE_DIR','/../..');
echo BASE_DIR.'/BE/libs/symphony/component/ClassLoader/2.1.0/UniversalClassLoader.php';
require_once BASE_DIR.'/BE/libs/symphony/component/ClassLoader/2.1.0/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('App\Location\Location', 'Location/Location');
// You can search the include_path as a last resort.
$loader->useIncludePath(true);
$loader->register();
use App\Location\Location;
new App\Location\Location(); //Fatal error: Class 'App\Location\Location' not found in C:/test/BE/src/main.php
file name: Location.php , dir: C:/test/BE/src/Location/Location.php
namespace App\Location;
class Location{
private $lat;
private $lng;
}