PHPackages                             vnetby/schemaorg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. vnetby/schemaorg

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

vnetby/schemaorg
================

A small library for working with schema.org markup. Enables the generation of JSON-LD markup.

1.0.9(2y ago)2341PHP &gt;=7.4

Since Dec 27Compare

[ Source](https://github.com/vnetby/schemaorg)[ Packagist](https://packagist.org/packages/vnetby/schemaorg)[ RSS](/packages/vnetby-schemaorg/feed)WikiDiscussions Synced yesterday

READMEChangelogDependenciesVersions (11)Used By (1)

PHP Schema.org
==============

[](#php-schemaorg)

A small library for working with schema.org markup. Enables the generation of JSON-LD markup.

Schema.org documentation:

Installation
------------

[](#installation)

You can install the library via Composer. Add the following line to your composer.json file:

```
{
    "require": {
        "vnetby/schemaorg": "#PACKAGE_VERSION#"
    }
}
```

Then run the following command:

```
composer install
```

You can install the latest version by running the command

```
composer require vnetby/schemaorg
```

Usage
-----

[](#usage)

Create an instance of the class type you want to use for markup, pass an array of properties to it according to the schema.org documentation:

```
use Vnet\Schemaorg\Types\Thing\Intangible\Trip\TouristTrip;
use Vnet\Schemaorg\Types\Thing\Place\AdministrativeArea\City;

$type = TouristTrip::fromArray([
    'name' => 'Trip name',
    'description' => 'Trip description',
    'itinerary' => [
        City::fromArray(['name' => 'City 1']),
        City::fromArray(['name' => 'City 2']),
        City::fromArray(['name' => 'City 3']),
        City::fromArray(['name' => 'City 4']),
        City::fromArray(['name' => 'City 5']),
    ]
]);
```

You can also set properties using the `setProp` method

```
$type->setProp('name', 'Trip name')->setProp('description', 'Trip description');
```

After filling in the object of the specified type, pass it to the `Jsonld` class

```
use Vnet\Schemaorg\Types\Thing\Intangible\Trip\TouristTrip;
use Vnet\Schemaorg\Types\Thing\Place\AdministrativeArea\City;

$type = TouristTrip::fromArray([
    'name' => 'Trip name',
    'description' => 'Trip description',
    'itinerary' => [
        City::fromArray(['name' => 'City 1']),
        City::fromArray(['name' => 'City 2']),
        City::fromArray(['name' => 'City 3']),
        City::fromArray(['name' => 'City 4']),
        City::fromArray(['name' => 'City 5']),
    ]
]);

$jsonld = Jsonld::create($type);
```

In the Jsonld class object, the following methods are available

```
$jsonld->toArray(); // returns an array of json-ld markup
$jsonld->generate(); // generates a string with json-ld markup
$jsonld->render(); // outputs the json-ld markup
```

Each class type has a set of methods for setting and retrieving properties

```
use Vnetby\Schemaorg\DataTypes\DataDate;
use Vnetby\Schemaorg\Types\Thing\Event\Event;

$event = new Event;
$event
    ->setEndDate(new DataDate('23-03-1995'))
    ->setStartDate(new DataDate('23-03-1995'));

$date = $event->getStartDate();
```

The use of DataType classes is optional. Each object of this class has its corresponding data type in PHP. For example, the DataBoolean class is equivalent to bool. This means that wherever the DataBoolean data type is specified, you can instead set/pass true/false instead of an instance of this class.

```
use Vnetby\Schemaorg\DataTypes\DataDate;
use Vnetby\Schemaorg\Types\Thing\Event\Event;

$event = new Event;
$event
    ->setEndDate('23-03-1995')
    ->setStartDate('23-03-1995');

$date = $event->getStartDate();
```

\*The classes from the DataTypes namespace are implemented to provide a clearer understanding of the data types associated with schema.org properties.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

10

Last Release

907d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ba443d8b981b668d5b79d877efd646cf0a49b79681cce9ca31c2d64d65f882ab?d=identicon)[vnetby](/maintainers/vnetby)

---

Top Contributors

[![VadzimKananovich](https://avatars.githubusercontent.com/u/48985024?v=4)](https://github.com/VadzimKananovich "VadzimKananovich (17 commits)")

### Embed Badge

![Health badge](/badges/vnetby-schemaorg/health.svg)

```
[![Health](https://phpackages.com/badges/vnetby-schemaorg/health.svg)](https://phpackages.com/packages/vnetby-schemaorg)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
