PHPackages                             mf2/shim - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mf2/shim

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

mf2/shim
========

A parsing library for parsing pages from a few common non-mf2 sites into the mf2 structure

v0.2.4(12y ago)152105[3 issues](https://github.com/indieweb/php-mf2-shim/issues)[1 PRs](https://github.com/indieweb/php-mf2-shim/pulls)1MITHTMLPHP &gt;=5.3.0

Since Aug 28Pushed 9y ago21 watchersCompare

[ Source](https://github.com/indieweb/php-mf2-shim)[ Packagist](https://packagist.org/packages/mf2/shim)[ RSS](/packages/mf2-shim/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (8)Used By (1)

php-mf2-shim
============

[](#php-mf2-shim)

An extension for [php-mf2](https://github.com/indieweb/php-mf2) which screen-scrapes some sites which don’t support [microformats2](http://microformats.org/wiki/microformats2) into canonical microformats data structures to make them easy to consume.

Supported sites:

- **twitter.com** — tweets are parsed as h-entries with h-card authors, replies to tweets on permalink pages are parsed
- **facebook.com** — post permalink pages are parsed as h-entries with h-card authors

Work-in-progress:

- instagram.com — no support right now

Installation
------------

[](#installation)

Install php-mf2-shim with Composer by adding "mf2/shim": "0.2.\*" to the require object in your composer.json and running `php composer.phar update`.

You could install it by just downloading php-mf2, /Mf2/functions.php, /Mf2/Shim/\*.php and including those, but please use Composer. Seriously, it’s amazing.

Usage
-----

[](#usage)

mf2-shim is PSR-0 autoloadable, so all you have to do to load it is:

- Include Composer’s auto-generated autoload file (/vendor/autoload.php)
- Call Mf2\\Shim\\parseTwitter() or parseFacebook() with the HTML (or a DOMDocument), and optionally the URL to resolve relative URLs against.

Examples
--------

[](#examples)

```
