lengthofrope/create-jsonld-tiny

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

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: 2021-10-16 03:13:42 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();