2017 © Pedro Peláez
 

library org

PHP Library for schema.org

image

appbels/org

PHP Library for schema.org

  • Saturday, February 25, 2017
  • by AppBels
  • Repository
  • 0 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 6 % Grown

The README.md

Org

PHP Library for schema.org, (*1)

Requirements

  • PHP >=5.3

Installation

Using composer, (*2)

$ composer require appbels/org
<?php
require_once('path/to/vendor/autoload.php');

// Start using Org/Schema library.

Or manual installation, download ZIP and copy all Org folder. Include autoload.php in your script and start use it., (*3)

<?php
require_once('path/to/org/autoload.php');

// Start using Org/Schema library.

Examples

Example from https://developers.google.com/search/docs/data-types/articles, (*4)

// ...

$newsArticle = new \Org\Schema\Thing\CreativeWork\Article\NewsArticle();

$webPage = new \Org\Schema\Thing\CreativeWork\WebPage();
$webPage->id = "https://google.com/article";
$newsArticle->mainEntityOfPage = $webPage;

$newsArticle->headline = "Article headline";
$newsArticle->image = array(
    "https://example.com/photos/1x1/photo.jpg",
    "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
);
$newsArticle->datePublished = "2015-02-05T08:00:00+08:00";
$newsArticle->dateModified = "2015-02-05T09:20:00+08:00";

$person = new \Org\Schema\Thing\Person();
$person->name = "John Doe";
$newsArticle->author = $person;

$organization = new \Org\Schema\Thing\Organization();
$organization->name = "Google";

$logo = new \Org\Schema\Thing\CreativeWork\MediaObject\ImageObject();
$logo->url = "https://google.com/logo.jpg";
$organization->logo = $logo;

$newsArticle->publisher = $organization;

$newsArticle->description = "A most wonderful article";

echo $newsArticle->toJson(JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);

Output generated, (*5)

{
    "author": {
        "name": "John Doe",
        "@type": "Person"
    },
    "dateModified": "2015-02-05T09:20:00+08:00",
    "datePublished": "2015-02-05T08:00:00+08:00",
    "headline": "Article headline",
    "publisher": {
        "logo": {
            "url": "https://google.com/logo.jpg",
            "@type": "ImageObject"
        },
        "name": "Google",
        "@type": "Organization"
    },
    "description": "A most wonderful article",
    "image": [
        "https://example.com/photos/1x1/photo.jpg",
        "https://example.com/photos/4x3/photo.jpg",
        "https://example.com/photos/16x9/photo.jpg"
    ],
    "mainEntityOfPage": {
        "@id": "https://google.com/article",
        "@type": "WebPage"
    },
    "@type": "NewsArticle",
    "@context": "http://schema.org"
}

See in examples directory for more examples., (*6)

The Versions

25/02 2017

dev-master

9999999-dev https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache-2.0 Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

v1.0

1.0.0.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

v1.1

1.1.0.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

v1.2

1.2.0.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

1.3

1.3.0.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

v1.4

1.4.0.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data

25/02 2017

v1.4.1

1.4.1.0 https://github.com/appbels/Org

PHP Library for schema.org

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

by Avatar AppBels

schema.org org php org appbels php builder for schema.org php structured data