Class Composer\Autoload\ClassLoader

ClassLoader implements a PSR-0, PSR-4 and classmap class loader.

$loader = new \Composer\Autoload\ClassLoader();

// register classes with namespaces $loader->add('Symfony\Component', DIR.'/component'); $loader->add('Symfony', DIR.'/framework');

// activate the autoloader $loader->register();

// to enable searching the include path (eg. for PEAR packages) $loader->setUseIncludePath(true);

In this example, if you try to use a class in the Symfony\Component namespace or one of its children (Symfony\Component\Console for instance), the autoloader will first look for the class under the component/ directory, and it will then fallback to the framework/ directory if not found before giving up.

This class is loosely based on the Symfony UniversalClassLoader.

Methods