class ClassLoader

ClassLoader implements a PSR-0 class loader

See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

$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.

@author Fabien Potencier <fabien@symfony.com> @author Jordi Boggiano <j.boggiano@seld.be>

Hierarchy

Expanded class hierarchy of ClassLoader

File

drupal/core/vendor/composer/ClassLoader.php, line 43

Namespace

Composer\Autoload
View source

Members

Namesort descending Modifiers Type Description Overrides
ClassLoader::$classMap private property
ClassLoader::$fallbackDirs private property
ClassLoader::$prefixes private property
ClassLoader::$useIncludePath private property
ClassLoader::add public function Registers a set of classes, merging with any others previously set.
ClassLoader::addClassMap public function
ClassLoader::findFile public function Finds the path to the file where the class is defined.
ClassLoader::getClassMap public function
ClassLoader::getFallbackDirs public function
ClassLoader::getPrefixes public function
ClassLoader::getUseIncludePath public function Can be used to check if the autoloader uses the include path to check for classes.
ClassLoader::loadClass public function Loads the given class or interface.
ClassLoader::register public function Registers this instance as an autoloader.
ClassLoader::set public function Registers a set of classes, replacing any others previously set.
ClassLoader::setUseIncludePath public function Turns on searching the include path for class files.
ClassLoader::unregister public function Unregisters this instance as an autoloader.