The AutoloaderFactoryOverviewStarting with version 1.12.0, Zend Framework now offers multiple autoloader strategies. Often, it will be useful to employ multiple autoloading strategies; as an example, you may have a class map for your most used classes, but want to use a PSR-0 style autoloader for 3rd party libraries. While you could potentially manually configure these, it may be more useful to define the autoloader configuration somewhere and cache it. For these cases, the AutoloaderFactory will be useful. Quick StartConfiguration may be stored as a PHP array, or in some form of configuration file. As an example, consider the following PHP array:
An equivalent INI-style configuration might look like the following: Zend_Loader_ClassMapAutoloader.application = APPLICATION_PATH "/autoload_classmap.php" Zend_Loader_ClassMapAutoloader.zf = APPLICATION_PATH "/../library/Zend/autoload_classmap.php" Zend_Loader_StandardAutoloader.namespaces.Phly\Mustache = APPLICATION_PATH "/../library/Phly/Mustache" Zend_Loader_StandardAutoloader.namespaces.Doctrine = APPLICATION_PATH "/../library/Doctrine" Once you have your configuration in a PHP array, you simply pass it to the AutoloaderFactory.
The AutoloaderFactory will instantiate each autoloader with the given options, and also call its register() method to register it with the SPL autoloader. Configuration Options
AutoloaderFactory OptionsAvailable MethodsExamplesPlease see the Quick Start for a detailed example.
|