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.
	 
	
		
			| 
				 public 
				
				
				 |  | 
		
			| 
				 public 
				
				
				 |  | 
		
			| 
				 public 
				
				
				 |  | 
		
			| 
				 public 
				
				
				 |  | 
		
			| 
				 public 
				
				
				 |  | 
		
			| 
				 public 
				
				
				 | 
			#
			addClassMap( array $classMap )
				
			 
				
					Parameters
						$classMaparray- $classMap Class to filename map | 
		
			| 
				 public 
				
				
				 | 
			#
			add( string $prefix, array|string $paths, boolean $prepend = false )
				
Registers a set of PSR-0 directories for a given prefix, either appending or
prepending to the ones previously set for this prefix. 
				
Registers a set of PSR-0 directories for a given prefix, either appending or
prepending to the ones previously set for this prefix. Parameters
						$prefixstring- $prefix The prefix$pathsarray|string- $paths The PSR-0 root directories$prependboolean- $prepend Whether to prepend the directories | 
		
			| 
				 public 
				
				
				 | 
			#
			addPsr4( string $prefix, array|string $paths, boolean $prepend = false )
				
Registers a set of PSR-4 directories for a given namespace, either appending
or prepending to the ones previously set for this namespace. 
				
Registers a set of PSR-4 directories for a given namespace, either appending
or prepending to the ones previously set for this namespace. Parameters
						$prefixstring- $prefix The prefix/namespace, with trailing '\\'$pathsarray|string- $paths The PSR-4 base directories$prependboolean- $prepend Whether to prepend the directoriesThrows | 
		
			| 
				 public 
				
				
				 | 
			#
			set( string $prefix, array|string $paths )
				
Registers a set of PSR-0 directories for a given prefix, replacing any others
previously set for this prefix. 
				
Registers a set of PSR-0 directories for a given prefix, replacing any others
previously set for this prefix. Parameters
						$prefixstring- $prefix The prefix$pathsarray|string- $paths The PSR-0 base directories | 
		
			| 
				 public 
				
				
				 | 
			#
			setPsr4( string $prefix, array|string $paths )
				
Registers a set of PSR-4 directories for a given namespace, replacing any
others previously set for this namespace. 
				
Registers a set of PSR-4 directories for a given namespace, replacing any
others previously set for this namespace. Parameters
						$prefixstring- $prefix The prefix/namespace, with trailing '\\'$pathsarray|string- $paths The PSR-4 base directoriesThrows | 
		
			| 
				 public 
				
				
				 | 
			#
			setUseIncludePath( boolean $useIncludePath )
				
Turns on searching the include path for class files. 
				
Turns on searching the include path for class files. Parameters
						$useIncludePathboolean- $useIncludePath | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			getUseIncludePath( )
				
Can be used to check if the autoloader uses the include path to check for
classes. 
				
Can be used to check if the autoloader uses the include path to check for
classes. Returns
						boolean
 | 
		
			| 
				 public 
				
				
				 | 
			#
			setClassMapAuthoritative( boolean $classMapAuthoritative )
				
Turns off searching the prefix and fallback directories for classes that have
not been registered with the class map. 
				
Turns off searching the prefix and fallback directories for classes that have
not been registered with the class map. Parameters
						$classMapAuthoritativeboolean- $classMapAuthoritative | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			isClassMapAuthoritative( )
				
Should class lookup fail if not found in the current class map? 
				
Should class lookup fail if not found in the current class map? Returns
						boolean
 | 
		
			| 
				 public 
				
				
				 | 
			#
			setApcuPrefix( string|null $apcuPrefix )
				
APCu prefix to use to cache found/not-found classes, if the extension is
enabled. 
				
APCu prefix to use to cache found/not-found classes, if the extension is
enabled. Parameters
						$apcuPrefixstring|null- $apcuPrefix | 
		
			| 
				 public 
				string|null
				
				 | 
			#
			getApcuPrefix( )
				
The APCu prefix in use, or null if APCu caching is not enabled. 
				
The APCu prefix in use, or null if APCu caching is not enabled. Returns
						string|null
 | 
		
			| 
				 public 
				
				
				 | 
			#
			register( boolean $prepend = false )
				
Registers this instance as an autoloader. 
				
Registers this instance as an autoloader. Parameters
						$prependboolean- $prepend Whether to prepend the autoloader or not | 
		
			| 
				 public 
				
				
				 | 
			#
			unregister( )
				
Unregisters this instance as an autoloader. 
				
Unregisters this instance as an autoloader. | 
		
			| 
				 public 
				boolean|null
				
				 | 
			#
			loadClass( string $class )
				
Loads the given class or interface. 
				
Loads the given class or interface. Parameters
						$classstring- $class The name of the classReturns
						boolean|null- True if loaded, null otherwise
 | 
		
			| 
				 public 
				string|false
				
				 | 
			#
			findFile( string $class )
				
Finds the path to the file where the class is defined. 
				
Finds the path to the file where the class is defined. Parameters
						$classstring- $class The name of the classReturns
						string|false- The path if found, false otherwise
 |