2017 © Pedro Peláez
 

library microdata

Get microdata from web page and check each type found with schema.org!

image

malenki/microdata

Get microdata from web page and check each type found with schema.org!

  • Saturday, April 26, 2014
  • by malenki
  • Repository
  • 3 Watchers
  • 7 Stars
  • 292 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

microdata

Get microdata from web page !, (*1)

Install

You can install this lib using Composer or by cloning this repository., (*2)

By using Composer, just add following lines into your composer.json file and run composer update:, (*3)

{
    "require": {
        "malenki/microdata": "dev-master"
    }
}

By cloning this repository, just do git clone https://github.com/malenkiki/microdata.git., (*4)

Coding using the library

With this library, you get microdata as tree object., (*5)

You can get microdata from given URL or given content as string:, (*6)

use \Malenki\Microdata;
$md = new Microdata('http://www.some-url.com/path/page.html');
//or
$md = new Microdata($some_content, Microdata::AS_STRING);
var_dump($md->extract());

In string context, print the JSON microdata tree:, (*7)

use \Malenki\Microdata;
$md = new Microdata('http://www.some-url.com/path/page.html');
print($md);

You can get statistical data about amount of types found:, (*8)

use \Malenki\Microdata;
$md = new Microdata('http://www.some-url.com/path/page.html');
var_dump($md->getAllTypeCount());

Now, you can check microdata with schemas defined on www.schema.org using their JSON definition type from website or from your own JSON file stored on your file system., (*9)

use \Malenki\Microdata;
$md = new Microdata('http://www.some-url.com/path/page.html');
$md->availableChecking(); // no arg: it takes JSON from official website
//or
$md->availableChecking('all.json'); // arg: it takes JSON from file system
print($md); // If errors found, they will be present into the returned JSON

Using CLI app

This library comes with a small CLI application too., (*10)

Its use is simple. If you have not idea how to used it, just do bin/microdata --help or read following lines., (*11)

To get microdata from an URL, do:, (*12)

$ bin/microdata 'http://some.url/path/'

Same as previous but getting JSON in place:, (*13)

$ bin/microdata --json 'http://some.url/path/'

You can request checking too (only schemas defined on schema.org):, (*14)

$ bin/microdata --check 'http://some.url/path/'

Same as previous but with a JSON schema on local filesystem:, (*15)

$ bin/microdata --check --check-file foo.json 'http://some.url/path/'

You can even use pipe or standard input too:, (*16)

$ echo '

Truc, (*17)

' | bin/microdata --pipe

Requirements

You must have PHP 5.3+ and DOM extension loaded., (*18)

Thanks

This lib is based on work of Philip Jägenstedt and Lin Clark., (*19)

The Versions

26/04 2014

dev-master

9999999-dev

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata

26/04 2014

dev-develop

dev-develop

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata

27/02 2014

1.1

1.1.0.0

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata

27/02 2014

dev-feature/ticket-4

dev-feature/ticket-4

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata

24/02 2014

1.0

1.0.0.0

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata

24/02 2014

dev-feature/ticket-3

dev-feature/ticket-3

Get microdata from web page and check each type found with schema.org!

  Sources   Download

MIT

The Requires

 

json html check dom web seo semantic microdata