Custom Zend_Application Resources
Sooner or later, you want to leverage Zend_Application better by creating your own resource plugins. This lets you reuse your initialisation work in multiple application that much easier and keeps your Boostrap class that much shorter!
In my case, I wanted to create a resource for CouchDb that checked that the database was created and if not, create it.
Creating your own plugin is easy enough. The obvious place is library/App/Application/Resource and a typical resource would look like this:
class App_Application_Resource_Couchdb extends Zend_Application_Resource_ResourceAbstract
* Defined by Zend_Application_Resource_Resource
* @return Phly_Couch|null
public function init()
// do stuff here to init CouchDB
$options = $this->getOptions();
// $options contains everything under 'resources.couchdb' in application.ini
You then need to tell Zend_Application about your new plugins. This is done with this line in application.ini:
pluginPaths.App_Application_Resource_ = "App/Application/Resource"
You can now have as many resource plugins as you like within the App_Application_Resource_ class-space.
Also, Matthew Weier O'Phinney has also written an article on Zend_Application which you should read too.