linclark / microdata-php
Extracts microdata from HTML using PHP.
Installs: 41 086
Dependents: 3
Suggesters: 0
Security: 0
Stars: 118
Watchers: 12
Forks: 24
Open Issues: 8
Requires (Dev)
- phpunit/phpunit: 4.1.x-dev
This package is not auto-updated.
Last update: 2024-11-05 07:11:08 UTC
README
Microdata is a syntax for embedding machine-readable metadata in HTML.
MicrodataPHP is a PHP library for extracting microdata from HTML documents. It is inspired by MicrodataJS, which is inspired by the native Microdata DOM API.
Example use:
require 'vendor/autoload.php';
use linclark\MicrodataPHP\MicrodataPhp;
$url = 'http://example.com';
$md = new MicrodataPhp($url);
$data = $md->obj();
// Get a property of a top level item.
print $data->items[0]->properties['name'][0];
// Get a property of a nested item.
print $data->items[0]->properties['hiringOrganization'][0]->properties['name'][0];
Requirements
- Autoloading (e.g. the autoloader provided by Composer)
- PHP 5.3+
Check out the 1.x branch for older setups.