Issues

ZF-2151: YAML Config Files

Description

Add support for YAML-formatted configuration files

Comments

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

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

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?

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 :)

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

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

I'm not going to be doing this one.

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

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

Ok. I will begin this weekend.

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

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

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

Greetings Gang,

Is this what you all have in mind? http://www.emanaton.com/code/php/zendconfigyml

If so, should I submit code somewhere?

Regards,

Sean P. O. MacCath-Moran www.emanaton.com

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?

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: http://emanaton.com/code/php/…

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

Regards,

Sean P. O. MacCath-Moran www.emanaton.com

You may want to incorporate some of the Symfony YAML code: http://components.symfony-project.org/yaml/

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.

adler

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?

Regards,

Sean P. O. MacCath-Moran www.emanaton.com

This improvement was implemented in ZF-1.11.

Will be in the next release.