How to setup a Zend_Application with an application.ini and a user.ini

Posted by Peter Smit on Stack Overflow See other posts from Stack Overflow or by Peter Smit
Published on 2010-01-10T11:53:24Z Indexed on 2010/05/27 21:31 UTC
Read the original article Hit count: 345

I am using Zend_Application and it does not feel right that I am mixing in my application.ini both application and user configuration.

What I mean with this is the following. For example, my application needs some library classes in the namespace MyApp_ . So in application.ini I put autoloaderNamespaces[] = "MyApp_". This is pure application configuration, no-one except a programmer would change these. On the other hand I put there a database configuration, something that a SysAdmin would change.

My idea is that I would split options between an application.ini and an user.ini, where the options in user.ini take preference (so I can define standard values in application.ini).

Is this a good idea? How can I best implement this? The idea's I have are

  • Extending Zend_Application to take multiple config files
  • Making an init function in my Bootstrap loading the user.ini
  • Parsing the config files in my index.php and pass these to Zend_Application (sounds ugly)

What shall I do? I would like to have the 'cleanest' solution, which is prepared for the future (newer ZF versions, and other developers working on the same app)

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework