How to register custom library in zend framework

I created my own library within Zend framework for some custom requirements. The prefix I use in each class is "Dtd_". I would like to know how I will register this so that it becomes available globally.

+3


source to share


2 answers


There are several ways to do this:

You can add namespaces to your application.ini file:

[production]
autoloaderNamespaces[] = "Dtd_"

      



Or, in your bootstrap:

protected function _initAutoloader()
{
    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->registerNamespace("Dtd_");
}

      

+5


source


You can use something like this



$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Dtd_');

      

+3


source







All Articles