PSR-0 compliant autoloader

Allows autoloading both namespaced and vendor-prefixed classes. Class lookups are performed on the filesystem. If a class file for the referenced class is not found, a PHP warning will be raised by include().

package Default

 Methods

Constructor

__construct(null|array|\Traversable $options = null

Allow configuration of the autoloader via the constructor.

inherited_from \Zend\Loader\SplAutoloader::__construct()

Parameters

$options

nullarray\Traversable

Defined by Autoloadable; autoload a class

autoload(string $class) : false | string
inherited_from \Zend\Loader\SplAutoloader::autoload()

Parameters

$class

string

Returns

falsestring

Is this autoloader acting as a fallback autoloader?

isFallbackAutoloader() : boolean

Returns

boolean

Register the autoloader with spl_autoload

register() : void

Typically, the body of this will simply be: spl_autoload_register(array($this, 'autoload'));

inherited_from \Zend\Loader\SplAutoloader::register()

Register a namespace/directory pair

registerNamespace(string $namespace, string $directory) : \Zend\Loader\StandardAutoloader

Parameters

$namespace

string

$directory

string

Returns

\Zend\Loader\StandardAutoloader

Register many namespace/directory pairs at once

registerNamespaces(array $namespaces) : \Zend\Loader\StandardAutoloader

Parameters

$namespaces

array

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

\Zend\Loader\StandardAutoloader

Register a prefix/directory pair

registerPrefix(string $prefix, string $directory) : \Zend\Loader\StandardAutoloader

Parameters

$prefix

string

$directory

string

Returns

\Zend\Loader\StandardAutoloader

Register many namespace/directory pairs at once

registerPrefixes(array $prefixes) : \Zend\Loader\StandardAutoloader

Parameters

$prefixes

array

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

\Zend\Loader\StandardAutoloader

Set flag indicating fallback autoloader status

setFallbackAutoloader(boolean $flag) : \Zend\Loader\StandardAutoloader

Parameters

$flag

boolean

Returns

\Zend\Loader\StandardAutoloader

Configure autoloader

setOptions(array|\Traversable $options) : \Zend\Loader\StandardAutoloader

Allows specifying both "namespace" and "prefix" pairs, using the following structure: array( 'namespaces' => array( 'Zend' => '/path/to/Zend/library', 'Doctrine' => '/path/to/Doctrine/library', ), 'prefixes' => array( 'Phly_' => '/path/to/Phly/library', ), 'fallback_autoloader' => true, )

inherited_from \Zend\Loader\SplAutoloader::setOptions()

Parameters

$options

array\Traversable

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

\Zend\Loader\StandardAutoloader

Load a class, based on its type (namespaced or prefixed)

loadClass(string $class, string $type) : boolean | string

Parameters

$class

string

$type

string

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

booleanstring

Normalize the directory to include a trailing directory separator

normalizeDirectory(string $directory) : string

Parameters

$directory

string

Returns

string

Transform the class name to a filename

transformClassNameToFilename(string $class, string $directory) : string

Parameters

$class

string

$directory

string

Returns

string

 Properties

 

Whether or not the autoloader should also act as a fallback autoloader

$fallbackAutoloaderFlag : boolean

Default

false
 

Namespace/directory pairs to search; ZF library added by default

$namespaces : array

Default

array()
 

Prefix/directory pairs to search

$prefixes : array

Default

array()

 Constants

 

ACT_AS_FALLBACK

ACT_AS_FALLBACK = 'fallback_autoloader' 
 

AUTOREGISTER_ZF

AUTOREGISTER_ZF = 'autoregister_zf' 
 

LOAD_NS

LOAD_NS = 'namespaces' 
 

LOAD_PREFIX

LOAD_PREFIX = 'prefixes' 
 

NS_SEPARATOR

NS_SEPARATOR = '\\' 
 

PREFIX_SEPARATOR

PREFIX_SEPARATOR = '_'