I have a folder with custom classes in a ZF 1.10 application. The folder is located in /library. How can I tell ZF where they are? Both application.ini and index.php set the
There are many possible solutions. The most common, when using Zend Application, is to register the namespace in application.ini
by adding:
autoloaderNamespaces[] = "Example_"
Other solutions:
include_path
using set_include_path()
(ad hoc solution)Set up autoloader in Bootstrap.php
:
protected function _initAutoloader()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace("Example"); // or Example_
}
Eventually, set up module or resource autoloader, eg.
$resourceLoader->addResourceTypes(array(
'acl' => array(
'path' => 'acls/',
'namespace' => 'Acl',
),
'example' => array(
'path' => 'examples/',
'namespace' => 'Example',
),
));