PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Examples

Example 123. Using Zend_Config_Yaml with sfYaml

As noted in the options section, Zend_Config_Yaml allows you to specify an alternate YAML parser at instantiation.

sfYaml is a Symfony component that implements a complete YAML parser in PHP, and includes a number of additional features including the ability to parse PHP expressions embedded in the YAML. In this example, we use the sfYaml::load() method as our YAML decoder callback. (Note: this assumes that the sfYaml class is either already loaded or available via autoloading.)

<?php
$config 
= new Zend_Config_Yaml(
    
APPLICATION_PATH '/configs/application.yaml',
    
APPLICATION_ENV,
    array(
'yaml_decoder' => array('sfYaml''load'))
);

Zend Framework