Improving the php-mf2 parser

During the past year, the popular php-mf2 microformats parser has received quite a few improvements. My site runs ProcessWire and one of the plugins for it uses php-mf2, so I have been spending some time on it.

My own experience with microformats started when I discovered the hCard microformat. I was impressed with the novelty of adding some simple HTML classes around contact information and having a browser extension parse it into an address book. Years later, when I started to get involved in the IndieWeb community, I learned a lot more about microformats2 and they became a key building block of my personal site.

php-mf2 is now much better at backwards-compatible parsing of microformats1. This is important because software should be able to consistently consume content whether it’s marked up with microformats1, microformats2, or a combination. An experimental feature for parsing language attributes has also been added. Finally, it’s now using the microformats test suite. Several other parsers use this test suite as well. This will make it easier to catch bugs and improve all of the different parsers.

php-mf2 is a stable library that’s ready to be installed in your software to start consuming microformats. It is currently used in Known, WordPress plugins, and ProcessWire plugins for richer social interactions. It’s also used in tools like XRay and microformats.io. I’m looking forward to more improvements to php-mf2 in the coming year as well as more software using it!

Original published at: https://gregorlove.com/2017/06/improving-the-php-mf2-parser/

Comments are closed.