YAML is a machine parsable data serialisation format for storing text, numerical data, arrays and more. It was designed for use with programming languages and has excellent support in Python, Perl and Ruby. Several C implementations exist and at least one (Syck) supports a PHP extension. If that explanation escapes you it’s a bit like having XML, only without the tag soup where nesting is related to indentation.

Now PHP has been slow (really slow) at adopting YAML in a serious way. As I previously noted PHP’s support is limited to the PHP Spyc Library, and a PHP extension which relies on the Syck C Library. The PHP extension has no PECL presence so it’s visibility to PHP developers isn’t the best but it is by far the fastest and more efficient YAML parser for PHP which benefits from the fact that the Syck Library is standard in Ruby since 1.8, and available for Perl (check CPAN) and Python.

So isn’t it time there was something native to PHP to allow everyone work with the YAML format? Well, I think so… So last week I ran off and did some digging, coding, and sacrificed a few white pigeons to the dark gods of inspiration. Once the pigeon blood and other…eh…bits were mopped up, I wrote the proposal for the Zend Framework – read it here. It’s nothing fancy, just a general outline and some sample use cases.

In the meantime I spent some time going over the cool pyyaml reference parser. Zend_Yaml will take it’s cue from pyyaml, with a pinch of personal OO improvement (not a Python “import from *” fanboy I’m afraid – too many methods floating between classes!), and a dash of PHP5 for added flavour. Keeping track of indentation will be painful to say the least – there lots of column, pointer, index messiness to get confused with but in general it’s straightforward enough. Just time consuming ;) .