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 Zend_Loader
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD {@link http://framework.zend.com/license/new-bsd}

 Methods

Constructor

__construct(null|array|\Traversable $options = null) : void

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

Error handler

handleError(mixed $errno, mixed $errstr) : void

Used by \loadClass during fallback autoloading in PHP versions prior to 5.3.0.

Parameters

$errno

mixed

$errstr

mixed

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

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

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

Returns

\Zend_Loader_StandardAutoloader

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

loadClass(string $class, string $type) : void

Parameters

$class

string

$type

string

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

 

$error

$error : boolean

Default

 

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 = '_'