require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('MyProject');
require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); // register multiple namespaces $loader->registerNamespace(array( 'MyProject', 'MyOtherProject' )); // register multiple prefixes $loader->registerPrefix(array( 'My_', 'Your_' ));
require_once 'Zend/Loader/Autoloader.php'; require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new Zend_Loader_StandardAutoloader(array( 'Zend' => '/path/to/zend/library', // specify package library path 'MyLib' => '/path/to/my/lib', // specify package library path 'PHPExcel' => '/path/to/PHPExcel' // specify package library path )); $loader->register();In this example, the code uses Zend_Loader to register an autoloader for multiple package libraries. The autoloader is configured with a mapping of package names to their library paths. When a class is requested that is in any of the registered package libraries, the autoloader will find and load it automatically. This example demonstrates the flexibility of Zend_Loader and how it can be used to load libraries from different sources.