lengthofrope/create-jsonld-tiny

This package is abandoned and no longer maintained. The author suggests using the lengthofrope/create-jsonld package instead.

Simple PHP library to create JSON-LD output. Tiny version

0.10.3 2016-04-02 17:37 UTC

This package is not auto-updated.

Last update: 2024-11-29 12:54:37 UTC


README

Simple PHP library to create JSON-LD output. Tiny version!

Note: Datatypes are not yet supported

This is the TINY VERSION of the class, mainly there for the following schema's:

  • Article,
  • BlogPosting,
  • Book,
  • Code,
  • Game,
  • Movie,
  • MusicRecording,
  • Painting,
  • Photograph,
  • Recipe,
  • Organization,
  • Corporation,
  • LocalBusiness,
  • SportsOrganization,

Usage:

use \LengthOfRope\JSONLD;
use \LengthOfRope\JSONLD\Schema;

$Create = JSONLD\Create::factory()->add(
    Schema\BookSchema::factory()
        ->setAuthor(Schema\PersonSchema::factory()->setName("NAME")->setEmail("email@example.com"))
        ->setAbout("PHP")
        ->setName("Superb PHP Book")
        ->setAlternateName("Book one of three")
)->add(
    Schema\OrganizationSchema::factory()
        ->setAddress(
            Schema\PostalAddressSchema::factory()
                ->setPostalCode("1234 AA")
                ->setStreetAddress("Somewhere 12")
                ->setAddressCountry("NL")
                ->setAddressLocality("Amersfoort")
                ->setEmail("email@example.com")
                ->setTelephone("033-1234567")
                ->setAddressRegion("Utrecht")
        )
        ->setName("Devver Company")
        ->setDescription("Just another developer")
);

echo $Create->getJSONLDScript();