Zend Framework

YAML Config Files

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.11.1
  • Component/s: Zend_Config
  • Labels:
    None

Description

Add support for YAML-formatted configuration files

Issue Links

Activity

Hide
Rob Allen added a comment -

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

Show
Rob Allen added a comment - The knack here is to decide if we need to write a native PHP implementation from scratch or if we can leverage an extension.
Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
Hide
Wil Sinclair added a comment -

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?

Show
Wil Sinclair added a comment - 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?
Hide
Rob Allen added a comment -

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

Show
Rob Allen added a comment - 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
Hide
Rob Allen added a comment -

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

Show
Rob Allen added a comment - A proposal would be good as it'll provide more community feedback, so postponing this issue until then.
Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - I will address the issues with YAML as a serialization/configuration format in PHP on the issues that I have just linked.
Hide
Rob Allen added a comment -

I'm not going to be doing this one.

Show
Rob Allen added a comment - I'm not going to be doing this one.
Hide
Adler Brediks Medrado added a comment -

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

Show
Adler Brediks Medrado added a comment - Can i try to do this ? I have some experience with YAML and i can try to put this on ZF.
Hide
Rob Allen added a comment -

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

Show
Rob Allen added a comment - Of course. Just remember that you have to develop your own code from scratch in order to comply with the CLA.
Hide
Adler Brediks Medrado added a comment -

Ok. I will begin this weekend.

Show
Adler Brediks Medrado added a comment - Ok. I will begin this weekend.
Hide
Ben Scholzen added a comment -

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

Show
Ben Scholzen added a comment - Don't forget the write the writer for it as well
Hide
Adler Brediks Medrado added a comment -

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

Show
Adler Brediks Medrado added a comment - Sure. I am thinking write the 'writer' and the 'loader', what do you think?
Hide
Adler Brediks Medrado added a comment -

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

Show
Adler Brediks Medrado added a comment - I think the correct is: Serialization and Deserialization for writer and loader.
Hide
Sean P. O. MacCath-Moran added a comment -

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

Show
Sean P. O. MacCath-Moran added a comment - 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
Hide
Adler Brediks Medrado added a comment -

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?

Show
Adler Brediks Medrado added a comment - 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?
Hide
Sean P. O. MacCath-Moran added a comment -

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://www.emanaton.com/code/php/zendconfigwriteryml

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

Regards,

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

Show
Sean P. O. MacCath-Moran added a comment - 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://www.emanaton.com/code/php/zendconfigwriteryml Please let me know if I may be of any assistance! Regards, Sean P. O. MacCath-Moran www.emanaton.com
Hide
Konr Ness added a comment -

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

Show
Konr Ness added a comment - You may want to incorporate some of the Symfony YAML code: http://components.symfony-project.org/yaml/
Hide
Adler Brediks Medrado added a comment -

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

Show
Adler Brediks Medrado added a comment - 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
Hide
Sean P. O. MacCath-Moran added a comment -

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

Show
Sean P. O. MacCath-Moran added a comment - 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
Hide
Ramon Henrique Ornelas added a comment -

This improvement was implemented in ZF-1.11.

Show
Ramon Henrique Ornelas added a comment - This improvement was implemented in ZF-1.11.
Hide
Stanislav Malyshev added a comment -

Will be in the next release.

Show
Stanislav Malyshev added a comment - Will be in the next release.

People

Vote (6)
Watch (7)

Dates

  • Due:
    Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1d
Original Estimate - 1 day
Remaining:
1d
Remaining Estimate - 1 day
Logged:
Not Specified
Time Spent - Not Specified