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

23 June 2006 - hKit version 0.4

This release of hKit has a number of small, but important improvements:

  • Refinment of the include-pattern code to prevented nested includes from causing infinite loops
  • Calls to getByURL() now return false if URL can’t be fetched
  • Added pre-flight check to ensure SimpleXML is available
  • Added deduping of class names that are only supposed to appear once
  • Prevented accumulation of multiple ‘value’ values
  • Tuned whitespace handling and treatment of DEL elements

With the hCard profile, hKit now pretty much supports all the parsing rules on the wiki and passes all the hCard tests in the test suite.

Comments

  1. ยง Eric Coleman:

    Have you considered proposing this to the PEAR repository, and/or making it Zend Framework compatible?

    Regards,
    Eric

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.