category Zend
package Zend_Loader

 Methods

Factory for autoloaders

factory(array | \Traversable $options) : void

Options should be an array or Traversable object of the following structure:

array(
    '' => $autoloaderOptions,
)

The factory will then loop through and instantiate each autoloader with the specified options, and register each with the spl_autoloader.

You may retrieve the concrete autoloader instances later using getRegisteredAutoloaders().

Note that the class names must be resolvable on the include_path or via the Zend library, using PSR-0 rules (unless the class has already been loaded).

Parameters

$options

array\Traversable

(optional) options to use. Defaults to Zend\Loader\StandardAutoloader

Exceptions

\Zend\Loader\Exception\InvalidArgumentException for invalid options
\Zend\Loader\Exception\InvalidArgumentException for unloadable autoloader classes
\Zend\Loader\Exception\DomainException for autoloader classes not implementing SplAutoloader

Retrieves an autoloader by class name

getRegisteredAutoloader(string $class) : \Zend\Loader\SplAutoloader

Parameters

$class

string

Exceptions

\Zend\Loader\Exception\InvalidArgumentException for non-registered class

Returns

Get an list of all autoloaders registered with the factory

getRegisteredAutoloaders() : array

Returns an array of autoloader instances.

Returns

array

Unregister a single autoloader by class name

unregisterAutoloader(string $autoloaderClass) : bool

Parameters

$autoloaderClass

string

Returns

bool

Unregisters all autoloaders that have been registered via the factory.

unregisterAutoloaders() : void

This will NOT unregister autoloaders registered outside of the fctory.

Get an instance of the standard autoloader

getStandardAutoloader() : \Zend\Loader\SplAutoloader

Used to attempt to resolve autoloader classes, using the StandardAutoloader. The instance is marked as a fallback autoloader, to allow resolving autoloaders not under the "Zend" namespace.

Returns

Checks if the object has this class as one of its parents

isSubclassOf(string $className, string $type) : bool

see \Zend\Loader\https://bugs.php.net/bug.php?id=53727
see \Zend\Loader\https://github.com/zendframework/zf2/pull/1807

Parameters

$className

string

$type

string

Returns

bool

 Properties

 

<p>All autoloaders registered using the factory</p>

$loaders : array

 

<p>StandardAutoloader instance for resolving autoloader classes via the include_path</p>

$standardAutoloader : \Zend\Loader\StandardAutoloader

 Constants

 

STANDARD_AUTOLOADER

STANDARD_AUTOLOADER