Horde/Yaml 1.0 Released

  • Posted by Mike Naberezny in PHP

    Horde/Yaml is a PHP 5 library for easily working with YAML data. This is the package’s first stable release.

    Chuck Hagenbuch started the library as an adaptation of Spyc around six months ago. Since then, he and I have been quietly using and improving it. Along the way, we fixed many issues, added support for pecl/syck, and wrote a test suite with PHPUnit.

    There are a couple of other libraries also derived from Spyc, notably the sfYaml class from the Symfony framework. Since these efforts also found and corrected issues, we incorporated as many of these fixes as we could find and added them to the test suite as we went along.

    At work, we frequently use YAML files for configuring our custom applications because our clients tend to like the format more than the alternatives. We’ve been using Horde/Yaml successfully for quite some time so we think it should generally work well for you also.

    There’s a nice tutorial on working with YAML in PHP 5 over on the new Rails for PHP Developers website. It includes everything you need to get started with Horde/Yaml.


  • comment by Adam 9 Jan 08

    I’ve actually been looking forward to this for a while.

  • comment by Otaku 27 Feb 08

    Is The Horde Project going to switch its configuration files from plain PHP to YAML in the future?

  • comment by Reporting Bugs? 27 Feb 08

    Hi and many thanks!

    Where can we report bugs / inconsistencies Horde_Yaml? I’m assuming that since the library prefers Syck if it is available that that implies Syck is the defacto standard of YAML to implement. In that case I’ve so-far noticed three differences between Syck and Horde_Yaml. I think it is important that differences are either eliminated or at least emulated since otherwise it makes little sense to allow switching parsers since doing so can lead to behavioral changes.

    1) An empty keyed element must be terminated by a newline in Syck if it is the last line in the file. Horde_Yaml does not require this.

    2) Horde_Yaml parses unquoted text strings as text even if they contain (but do not start) with a hash marker (ie: a brace): Syck does not.

    foo: This fails in Syck { but not in Horde_Yaml.
    bar: “This works in both { Syck and Horde_Yaml.”
    foobar: {this fails everywhere

    3) Syck seems to require whitespace after a key, at least for unqouted data whereas Horde_Yaml is just as happy without the whitespace.

    foo:this fails in Syck but works in Horde_Yaml

    Thanks for the good work!

  • comment by Chuck Hagenbuch 27 Feb 08

    Otaku- There are a lot of advantages to config files being PHP, so I doubt we’ll drop it entirely. That said, it’s possible we’ll switch to a setup where configurations can be stored in a backend of your choosing, in which case we’d certainly include YAML.

    Reporting Bugs- Please create a ticket (or tickets) in the Horde Framework Packages queue on http://bugs.horde.org/. Our main goal is compatibility with the YAML spec, but we’ll certainly resolve differences with syck where they’re our fault (which is entirely possible).

  • comment by she 10 May 08

    i hope that php’s support for yaml improves

    i am storing most of my stuff in yaml these days and using ruby, but it would be GREAT if i could use php with yaml too

    last time i tried (some php yaml binding) it was so incredibly slow, that parsing it with a quick-built php parser was faster :/

Sorry, the comment form is closed at this time.