PHP code example of nypl / schemabuilder

1. Go to this page and download the library: Download nypl/schemabuilder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nypl / schemabuilder example snippets



$book = new NYPL\SchemaBuilder\Schema('Book');


$book->addProperty('name', 'Le concerto');
$book->addProperty('author', 'Ferchault, Guy');


// First, build the Offer object
$offer = new Schema('Offer');
$offer->addProperty('availability', 'http://schema.org/InStock');
$offer->addProperty('serialNumber', 'CONC91000937');
// Then, set the "offers" property on the Book object with the Offer object
$book->addProperty('offers', $offer);

<head>
...
 $book->outputJsonLd();

// Output an Object
<div  $book->outputMicrodata(); 

 $book->outputMicrodata('additionalType', 'link');