PHP Class SplClassLoader, php-peg

http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 Example which loads classes for the Doctrine Common package in the Doctrine\Common namespace. $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); $classLoader->register();
Author: Jonathan H. Wage ([email protected])
Author: Roman S. Borschel ([email protected])
Author: Matthew Weier O'Phinney ([email protected])
Author: Kris Wallsmith ([email protected])
Author: Fabien Potencier ([email protected])
Show file Open project: hafriedlander/php-peg Class Usage Examples

Public Methods

Method Description
__construct ( string $ns = null, $includePath = null ) Creates a new SplClassLoader that loads classes of the specified namespace.
getFileExtension ( ) : string Gets the file extension of class files in the namespace of this class loader.
getIncludePath ( ) : string Gets the base include path for all class files in the namespace of this class loader.
getNamespaceSeparator ( ) : void Gets the namespace seperator used by classes in the namespace of this class loader.
loadClass ( string $className ) : void Loads the given class or interface.
register ( ) Installs this class loader on the SPL autoload stack.
setFileExtension ( string $fileExtension ) Sets the file extension of class files in the namespace of this class loader.
setIncludePath ( string $includePath ) Sets the base include path for all class files in the namespace of this class loader.
setNamespaceSeparator ( string $sep ) Sets the namespace separator used by classes in the namespace of this class loader.
unregister ( ) Uninstalls this class loader from the SPL autoloader stack.

Method Details

__construct() public method

Creates a new SplClassLoader that loads classes of the specified namespace.
public __construct ( string $ns = null, $includePath = null )
$ns string The namespace to use.

getFileExtension() public method

Gets the file extension of class files in the namespace of this class loader.
public getFileExtension ( ) : string
return string $fileExtension

getIncludePath() public method

Gets the base include path for all class files in the namespace of this class loader.
public getIncludePath ( ) : string
return string $includePath

getNamespaceSeparator() public method

Gets the namespace seperator used by classes in the namespace of this class loader.
public getNamespaceSeparator ( ) : void
return void

loadClass() public method

Loads the given class or interface.
public loadClass ( string $className ) : void
$className string The name of the class to load.
return void

register() public method

Installs this class loader on the SPL autoload stack.
public register ( )

setFileExtension() public method

Sets the file extension of class files in the namespace of this class loader.
public setFileExtension ( string $fileExtension )
$fileExtension string

setIncludePath() public method

Sets the base include path for all class files in the namespace of this class loader.
public setIncludePath ( string $includePath )
$includePath string

setNamespaceSeparator() public method

Sets the namespace separator used by classes in the namespace of this class loader.
public setNamespaceSeparator ( string $sep )
$sep string The separator to use.

unregister() public method

Uninstalls this class loader from the SPL autoloader stack.
public unregister ( )