Json and Yaml reader/writer for Zend\Config

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Json and Yaml reader/writer for Zend\Config

Enrico Zimuel-2
Hi all,

i just sent the PR https://github.com/zendframework/zf2/pull/986
for the Json and Yaml reader/writer of Zend\Config.
I added the @include syntax to Json and Yaml to include external files
in a configuration file.

For instance you can use the following syntax in a JSON file:
{ "@include" : "target.json" }
where 'target.json' contains a JSON data structure.

You can do the same with YAML:
@include: target.yaml

The Yaml adapter needs an external library to parse the YAML data
structure or the PECL extension http://php.net/manual/en/book.yaml.php.
To specify the external library you can pass the callback during the
constructor of Zend\Config\Reader\Yaml or Zend\Config\Writer\Yaml.
If you don't pass a parameter in the contructor the class will try to
use the PECL extension.
The external library can also be specified using the setYamlDecoder()
for Zend\Config\Reader\Yaml and setYamlEncoder() for
Zend\Config\Writer\Yaml.

Regards,
Enrico Zimuel

--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com