$includeFile
$includeFile
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.
$vendorDir : ?string
$prefixLengthsPsr4 : array[]
$prefixDirsPsr4 : array[]
$fallbackDirsPsr4 : array[]
$prefixesPsr0 : array[]
$fallbackDirsPsr0 : array[]
$useIncludePath : bool
$classMap : string[]
$classMapAuthoritative : bool
$missingClasses : bool[]
$apcuPrefix : ?string
$registeredLoaders : self[]
add(string $prefix, string[]|string $paths, bool $prepend = false) : void
Registers a set of PSR-0 directories for a given prefix, either appending or prepending to the ones previously set for this prefix.
string | $prefix | The prefix |
string[]|string | $paths | The PSR-0 root directories |
bool | $prepend | Whether to prepend the directories |
addPsr4(string $prefix, string[]|string $paths, bool $prepend = false) : void
Registers a set of PSR-4 directories for a given namespace, either appending or prepending to the ones previously set for this namespace.
string | $prefix | The prefix/namespace, with trailing '\' |
string[]|string | $paths | The PSR-4 base directories |
bool | $prepend | Whether to prepend the directories |
setPsr4(string $prefix, string[]|string $paths) : void
Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.
string | $prefix | The prefix/namespace, with trailing '\' |
string[]|string | $paths | The PSR-4 base directories |