I'd prefer to use native php for Zend configuration. How would I convert this Zend application.ini segment into php?
[development : production]
production section supposedly inherits from development section. P.S we are talking about ZEND framework here.
Update: Looks like I wasn't clear with my question.
All I wanted to know was how Zend_Application handles inheritance/nesting in php options file comparing to ini or xml.
INI config example (everything in production section will be inherited by testing and development section):
[production]
autoloaderNamespaces[] = "My_"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
[testing : production]
bootstrap.class = "productionBootstrap"
[development : production]
bootstrap.class = "developmentBootstrap"
XML config example (everything in production section will be inherited by staging section, note extends keyword):
<?xml version="1.0"?>
<configdata>
<production>
<webhost>www.example.com</webhost>
<database>
<adapter>pdo_mysql</adapter>
<params>
<host>db.example.com</host>
<username>dbuser</username>
<password>secret</password>
<dbname>dbname</dbname>
</params>
</database>
</production>
<staging extends="production">
<database>
<params>
<host>dev.example.com</host>
<username>devuser</username>
<password>devsecret</password>
</params>
</database>
</staging>
</configdata>
PHP config example No inheritance/nesting? Is there a way to make inheritance/nesting work without doing manual array merging?
return array(
'production' => array(
$test1 => 'aaaaaaa'
),
'staging' => array(
$test2 => 'bbbbbb'
),
'testing' => array(
$test3 => 'bbbbbb'
)
)
UPDATE
In retrospect - just wanted to add that there are certain advantages to using php arrays instead of ini files for configuration: some info
· they can be cached by an opcode cache
· they support constants
· they allow to create easily readable config trees
· they support boolean and integer values