Zend Framework application.ini Cheat-Sheet

With the release of Zend Framework 1.8 came the long awaited component for bootstrapping a Zend Framework application. Many different bootstrapping-solutions became obsolete with Zend_Application.

 

In the beginning of the framework most developers didn‘t give much thought on bootstrapping. Most of the initialisation work was done directly in index.php, the central starting point of the application. Teams often moved that bootstrapping code to a separate configuration script. The solution worked, but many people wanted a more standardised process for application initialisation.

During time it became popular to bootstrap applications with frontcontroller plugins. Initialisation tasks, like connecting to a database or reading a configuration file were separated in small methods and became more manageable. But this bootstrapping alternative was not a standard and was adapted differently by each development team.

 

All this is long gone in the past since the introduction of Zend_Application and the bootstrapping resource adapters. Zend introduced a standard bootstrapping mechanism into their framework. Many of the options from different framework components can now be configured in the applications configuration file application.ini.

 

One problem persists although: the documentation. All the parameters for components like View, Session, Database etc. are documented either with the bootstrap resource, the component itself or both. Some of them are even completely undocumented and have to be extracted from the framework source code. Unfortunately there is no reference of all possibilities of the application.ini. To make my life – and that of other Zend Framework developers – a little bit easier, I created such a reference in form of an application.ini file with all possible options, grouped by resource and with some links and explanations.

 

The code below shows the section with bootstrapping options for the FrontController. Each section has a header containing links to relevant documentation pages in the official Zend Framework documentation.

 

;+-----------------+
;| FrontController |
;+-----------------+
;
; Configuration for the frontcontroller.
;
; http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.frontcontroller
; http://framework.zend.com/manual/en/zend.controller.front.html
;
; resources.frontController.controllerDirectory = <CONTROLLER_DIR>
; resources.frontController.modulecontrollerdirectoryname = <NAME>
; resources.frontController.moduledirectory = <NAME>
; resources.frontController.defaultcontrollername = 'index'
; resources.frontController.defaultaction = 'index'
; resources.frontController.defaultmodule = 'default'
; resources.frontController.baseurl = <BASE_URL>
; resources.frontController.returnresponse = false
; resources.frontController.throwexceptions = false
; resources.frontController.actionhelperpaths.<HELPER_PREFIX> = <HELPER_PATH>
; resources.frontController.noErrorHandler = false
; resources.frontController.noViewRenderer = false
; resources.frontController.useDefaultControllerAlways = false
; resources.frontController.disableOutputBuffering = false
;
; Loading a plugin
; resources.frontController.plugins = <PLUGIN_CLASS>
; 
; Loading multiple plugins
; resources.frontController.plugins[] = <PLUGIN_CLASS>
; resources.frontController.plugins[] = <PLUGIN_CLASS>
;
; Loading multiple plugins with stack index
; resources.frontController.plugins[0].class = <PLUGIN_CLASS>
; resources.frontController.plugins[0].stackindex = <PLUGIN_INDEX>
; resources.frontController.plugins[1].class = <PLUGIN_CLASS>
; resources.frontController.plugins[1].stackindex = <PLUGIN_INDEX>
;
; Setting frontcontroller parameters
; resources.frontController.<PARAM> = <VALUE>
; or
; resources.frontController.params.<PARAM> = <VALUE>

 

All options are commented out per default and you have to remove the trailing semicolon to activate the option. Options with a value in < > need to be replaced with a value of your liking. Default values in the file represent the default values in the Zend Framework component.

For several options I have included additional comments for clarifying the possible configuration. I tried to include all alternatives where there are several ways for configure some part of a component.

 

You can download the complete file on Github and use it directly in your next project or as a reference for your configuration file.

 

https://github.com/feibeck/application.ini

 

If you have any suggestions or find bugs, feel free to fork the file on Github and send me pull requests!

 

6 Kommentare

  1. This is awesome! The application.ini is one of those things that can be amazingly useful, but was always hampered by the difficulty of having to discover the individual configuration options. This is a resource that every Zend Framework developer should have. Thanks for the great work!

    1. The post is quite old now and I did not check for updates on Zend Framework and fix the application.ini cheat sheet on github. If there are missing configs, please issue a pull request and I will happily merge it. Thank you :-)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert