Zend_Config_YamlOverview» YAML is a recursive acronym meaning "YAML Ain't Markup Language", and is intended as a "human friendly data serialization standard for all programming languages." It is often used for application configuration. Zend_Config_Yaml is a lightweight Zend_Config extension. It includes a parser capable of recognizing most common YAML syntax used for purposes of configuration, and allows specifying other parsers should you want more complex syntax (e.g., ext/syck, spyc, sfYaml, etc.). Quick StartThe following is a YAML version of a standard application configuration.
To utilize it, you simply instantiate Zend_Config_Yaml, pointing it to the location of this file and indicating the section of the file to load. By default, constant names found in values will be substituted with their appropriate values.
Once instantiated, you use it as you would any other configuration object. Configuration OptionsThe following options may be passed as keys to the third, $options argument of the constructor.
Zend_Config_Yaml OptionsAvailable Methods
ExamplesExample #1 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.)
|