The state of YAML in PHP

Due to work on the Jackknife, I had occasion to learn more than I could have ever wanted about parsing YAML in PHP. YAML (‘YAML Ain’t Markup Language’) is a data serialization format – otherwise known as markup – designed to be easily human readable. While it succeeds at that, it’s a pain to support beyond simple key:value pairings. Pretty straightforward, on paper. Where this is relevant is that the company responsible for EVE-Online, CCP, has a fetish for YAML, using it in places it flat out doesn’t make sense, with promise of more to come. So dealing with YAML is a necessary evil, as far as using the EVE API goes.

Here’s where the problem comes in: YAML parsing support is inconsistent as hell. Not just in PHP. However, PHP has a few PECL plugins that allow one to use an established library that actually, you know, works. Except, problem: neither were compiled in by default. Being on a shared host, this means I can’t use either of them – so it necessitated some contortion to get a working YAML parser. I ended up testing 6 methods of parsing YAML in PHP. Continue reading