hKit Microformats Toolkit for PHP5

hKit is a simple toolkit for extracting common microformats from a page. The page can be presented as a string or a URL, and the result is handed back as a standard PHP array structure. hKit uses SimpleXML for parsing, and therefore requires PHP5.

hKit has a modular structure, with a simple ‘profile’ for each microformat it supports. As the project is very young (June 2006), the only module currently supported is hCard. You can download the latest version on the right. Let me know if you use it somewhere.

In use

<?php 
    include('hkit.class.php');
    $hKit = new hKit;
    $result = $hKit->getByURL('hcard', 'http://microformats.org/');
    print_r($result);
?>

Updates

22 June 2006 - hKit version 0.3

Last night I dropped another update to hKit – version 0.3. Download.

I’m still focussing on getting hCard support properly working before branching out to other µFs.

Key improvements are:

  • Support for include-pattern
  • Support for td@headers pattern
  • Performs implied n-optimization expansion, rather than leaving it to the user
  • Passes all hCard tests, apart from the telephone example cited yesterday

Problems I know I haven’t dealt with yet, but have in-the-shower solutions for are:

  • Infinite loop protection for include-pattern
  • Nested formats, e.g. hCard inside hReview, or XFN inside hCard, or both!
  • Flight-checks and fallover for different PHP environments

Any testing and feedback is appreciated.

Comments

  1. § Gerard:

    thanks for writing this class! I’ve been playing around with it over at gerardramos.com/mf . I’m really interested in building additional modules.

    any interest in picking up this project again? I’m down for helping out in any way I can.

Download Latest Version

The latest version can be downloaded from Google Code.

Stay Up-to-date

I publish hKit update feeds in RSS and Atom formats.

Licence

hKit is licensed under a LGPL 2.1 license.