ZF-2151: YAML Config Files

Issue Type: New Feature Created: 2007-11-05T20:06:54.000+0000 Last Updated: 2010-10-19T17:15:21.000+0000 Status: Resolved Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Wil Sinclair (wil) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Config

Related issues: - ZF-2147



Add support for YAML-formatted configuration files


Posted by Rob Allen (rob) on 2008-03-09T16:46:37.000+0000

The knack here is to decide if we need to write a native PHP implementation from scratch or if we can leverage an extension.

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:01.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Wil Sinclair (wil) on 2008-06-09T12:45:17.000+0000

Is this something that we'd want to do? It should be submitted as a proposal in any case. If we'd like to do it, should we only do the subset of YAML that we's need for config?

Posted by Rob Allen (rob) on 2008-06-09T12:51:45.000+0000

I assumed we did as you reported it :)

Some people like Yaml, so I can see the usefulness of a Zend_Config_Yaml. I suspect it would be fairly slow though, so caching tips would need to be documented.

I don't know enough about Yaml to know how much of the spec would need to be supported and don't have enough interest in the format to develop it myself. More than happy to review should someone step up to the plate with a class and unit tests :)

Posted by Rob Allen (rob) on 2008-06-09T12:57:34.000+0000

A proposal would be good as it'll provide more community feedback, so postponing this issue until then.

Posted by Wil Sinclair (wil) on 2009-01-14T14:54:29.000+0000

I will address the issues with YAML as a serialization/configuration format in PHP on the issues that I have just linked.

Posted by Rob Allen (rob) on 2009-03-21T13:49:42.000+0000

I'm not going to be doing this one.

Posted by Adler Brediks Medrado (adlermedrado) on 2009-03-26T07:03:44.000+0000

Can i try to do this ? I have some experience with YAML and i can try to put this on ZF.

Posted by Rob Allen (rob) on 2009-03-26T07:49:47.000+0000

Of course. Just remember that you have to develop your own code from scratch in order to comply with the CLA.

Posted by Adler Brediks Medrado (adlermedrado) on 2009-03-27T16:21:00.000+0000

Ok. I will begin this weekend.

Posted by Ben Scholzen (dasprid) on 2009-03-29T12:47:52.000+0000

Don't forget the write the writer for it as well :)

Posted by Adler Brediks Medrado (adlermedrado) on 2009-03-29T13:02:08.000+0000

Sure. I am thinking write the 'writer' and the 'loader', what do you think?

Posted by Adler Brediks Medrado (adlermedrado) on 2009-03-29T13:07:08.000+0000

I think the correct is: Serialization and Deserialization for writer and loader.

Posted by Sean P. O. MacCath-Moran (emanaton) on 2009-04-04T10:48:55.000+0000

Greetings Gang,

Is this what you all have in mind?

If so, should I submit code somewhere?


Sean P. O. MacCath-Moran <>

Posted by Adler Brediks Medrado (adlermedrado) on 2009-04-23T17:09:02.000+0000

Only to update you:

i am working on it and i will show something next month.

Sean, you are using the syck extension, right? i am looking it too but now i am developing a PHP only YAMl support for ZF but i will after this write the classes using syck too.

I think is a good ideia ZF support the two options. What do you think?

Posted by Sean P. O. MacCath-Moran (emanaton) on 2009-04-27T17:45:04.000+0000

Greetings Adler,

Indeed, I very much agree that providing an option that does not require the user to have special mods installed is a good idea; not everyone will have the capability to add PHP mods to the server they are working with. However, in my own informal tests I found that the available "raw PHP code" options for parsing and writing yaml files were no where near as fast as the syck library, so I assert that the syck method should be preferred within the code (unless, of course, something even better becomes available). If I were writing this class with the dual implementation, my approach would be to implement the Yaml parser and writer in a separate class from Config_Yaml, then detect if syck is available, using it if so, or instantiating the Yaml parser class if not. In this way the Config_Yaml class may be kept as light as possible while the concerns of the Config object creation and yaml file manipulations are kept separate but loosely coupled.

Do you plan on writing the Config_Yaml_Writer class as well? If so, I've implemented a functionally complete version of this as well that you might draw upon:…

Please let me know if I may be of any assistance!


Sean P. O. MacCath-Moran <>

Posted by Konr Ness (konrness) on 2009-05-22T09:14:48.000+0000

You may want to incorporate some of the Symfony YAML code:

Posted by Adler Brediks Medrado (adlermedrado) on 2009-05-23T11:47:50.000+0000

Hello Sean and Konr

I think your aproach is very cool. Checking if the user has the extension enabled and if so use it, if not use a pure PHP implementation. The pure PHP implementation of course is slower than the one that use syck.

I take a look in your work and it is very good but to put a code in the ZF we have to agree with the CLA. This is the reason i am writing a code from scratch and that is the reason too we cannot use the symfony YAML code.

Best regards for you all.


Posted by Sean P. O. MacCath-Moran (emanaton) on 2009-05-23T12:06:20.000+0000

Greetings Adler,

Actually, I faxed in a CLA some time ago and never heard back. I've reached the point where there are several issues I'd REALLY like to start contributing solutions for to the project, but cannot since the CLA has not be responded to.

Can you advise me on how to proceed with that?


Sean P. O. MacCath-Moran <>

Posted by Stanislav Malyshev (stas) on 2009-11-23T12:08:27.000+0000

Please look at…

Posted by Ramon Henrique Ornelas (ramon) on 2010-10-19T15:56:07.000+0000

This improvement was implemented in ZF-1.11.

Posted by Stanislav Malyshev (stas) on 2010-10-19T17:15:20.000+0000

Will be in the next release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.