PHPackages                             secit-pl/schema-org - 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. secit-pl/schema-org

ActiveLibrary

secit-pl/schema-org
===================

Schema.org classes.

26.0.2(3mo ago)427.0k↓33.3%31MITPHPPHP &gt;=5.4.0

Since Jan 6Pushed 3mo agoCompare

[ Source](https://github.com/secit-pl/schema-org)[ Packagist](https://packagist.org/packages/secit-pl/schema-org)[ Docs](http://secit.pl)[ RSS](/packages/secit-pl-schema-org/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (9)Used By (1)

Schema.org class mapping
========================

[](#schemaorg-class-mapping)

A class mapping for the schema.org data types, types and properties.

#### BC break warning

[](#bc-break-warning)

From release 3.3.2 all properties should be suffixed by the word Property and all types should be suffixed by the word Type. All properties without Property suffix and and all types without Type suffix are now marked as deprecated. This change is required to support PHP 7.x which have a few new restricted words which cannot be used as a class names.

Please change your code and add the suffix to use the new naming schema.

**All deprecated (non suffixed) classes will be removed in release 3.4.**

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

[](#installation)

From the command line run

```
$ composer require secit-pl/schema-org

```

Usage
-----

[](#usage)

First create the data structure:

```
use SecIT\SchemaOrg\Mapping\DataType;
use SecIT\SchemaOrg\Mapping\Property;
use SecIT\SchemaOrg\Mapping\Type;

$breadcrumbs = new Type\BreadcrumbListType();

$element1 = new Type\ListItemType();
$element1->setPosition(new Property\PositionProperty(new DataType\IntegerType(1)));
$element1->setItem(
    new Property\Item(
        (new Type\ThingType('http://google.pl/#test'))->setName(
            new Property\NameProperty(
                new DataType\TextType('Test')
            )
        )
    )
);
$breadcrumbs->addItemListElement(new Property\ItemListElementProperty($element1));

$element2 = new Type\ListItemType();
$element2->setPosition(new Property\PositionProperty(new DataType\IntegerType(2)));
$element2->setItem(
    new Property\ItemProperty(
        (new Type\ThingType('http://google.pl/#qweqwe'))->setName(
            new Property\NameProperty(
                new DataType\TextType('Test 122')
            )
        )
    )
);
$breadcrumbs->addItemListElement(new Property\ItemListElementProperty($element2));

$breadcrumbs->setNumberOfItems(
    new Property\NumberOfItemsProperty(
        new DataType\IntegerType(
            count($breadcrumbs->getItemListElements())
        )
    )
);
```

Now you can convert it to the JSON-LD string as following

```
$schemaOrg = new \SecIT\SchemaOrg();
echo $schemaOrg->toJsonLd($breadcrumbs);
```

The output should be a valid schema.org JSON-LD:

```
{"@context":"http:\/\/schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","item":{"@type":"Thing","@id":"http:\/\/google.pl\/#test","name":"Test"},"position":1},{"@type":"ListItem","item":{"@type":"Thing","@id":"http:\/\/google.pl\/#qweqwe","name":"Test 122"},"position":2}],"numberOfItems":2}
```

If you'd like to check the output validation you can use the tool provided by Google:

Code examples
-------------

[](#code-examples)

### Breadcrumbs

[](#breadcrumbs)

```
use SecIT\SchemaOrg\Mapping\DataType;
use SecIT\SchemaOrg\Mapping\Property;
use SecIT\SchemaOrg\Mapping\Type;

$breadcrumbs = new Type\BreadcrumbListType();

$element1 = new Type\ListItemType();
$element1->setPosition(new Property\PositionProperty(new DataType\IntegerType(1)));
$element1->setItem(
    new Property\ItemProperty(
        (new Type\ThingType('http://google.pl/#test'))->setName(
            new Property\NameProperty(
                new DataType\TextType('Test')
            )
        )
    )
);
$breadcrumbs->addItemListElement(new Property\ItemListElementProperty($element1));

$element2 = new Type\ListItemType();
$element2->setPosition(new Property\PositionProperty(new DataType\IntegerType(2)));
$element2->setItem(
    new Property\ItemProperty(
        (new Type\ThingType('http://google.pl/#qweqwe'))->setName(
            new Property\NameProperty(
                new DataType\TextType('Test 122')
            )
        )
    )
);
$breadcrumbs->addItemListElement(new Property\ItemListElementProperty($element2));

$breadcrumbs->setNumberOfItems(
    new Property\NumberOfItemsProperty(
        new DataType\IntegerType(
            count($breadcrumbs->getItemListElements())
        )
    )
);
```

The output:

```
{"@context":"http:\/\/schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","item":{"@type":"Thing","@id":"http:\/\/google.pl\/#test","name":"Test"},"position":1},{"@type":"ListItem","item":{"@type":"Thing","@id":"http:\/\/google.pl\/#qweqwe","name":"Test 122"},"position":2}],"numberOfItems":2}
```

### Product

[](#product)

```
use SecIT\SchemaOrg\Mapping\DataType;
use SecIT\SchemaOrg\Mapping\Property;
use SecIT\SchemaOrg\Mapping\Type;

$product = new Type\ProductType();
$product
    ->setName(
        new Property\NameProperty(
            new DataType\TextType('Kenmore White 17" Microwave')
        )
    )
    ->setDescription(
        new Property\DescriptionProperty(
            new DataType\TextType('0.7 cubic feet countertop microwave. Has six preset cooking categories and convenience features like Add-A-Minute and Child Lock.')
        )
    )
    ->setImage(
        new Property\ImageProperty(
            new DataType\URLType('kenmore-microwave-17in.jpg')
        )
    )
    ->setAggregateRating(
        new Property\AggregateRatingProperty(
            (new Type\AggregateRatingType())
                ->setRatingValue(
                    new Property\RatingValueProperty(
                        new DataType\NumberType(3.5)
                    )
                )
                ->setReviewCount(
                    new Property\ReviewCountProperty(
                        new DataType\IntegerType(11)
                    )
                )
        )
    )
    ->setOffers(
        new Property\OffersProperty(
            (new Type\OfferType())
                ->setPriceCurrency(
                    new Property\PriceCurrencyProperty(
                        new DataType\TextType('USD')
                    )
                )
                ->setPrice(
                    new Property\PriceProperty(
                        new DataType\NumberType(55.00)
                    )
                )
                ->setAvailability(new Property\AvailabilityProperty(
                    new Type\InStockType()
                ))
        )
    )
    ->setReview(
        new Property\ReviewProperty([
            (new Type\ReviewType())
                ->setReviewRating(
                    new Property\ReviewRatingProperty(
                        (new Type\RatingType())
                            ->setBestRating(
                                new Property\BestRatingProperty(
                                    new DataType\NumberType(5)
                                )
                            )
                            ->setRatingValue(
                                new Property\RatingValueProperty(
                                    new DataType\NumberType(1)
                                )
                            )
                            ->setWorstRating(
                                new Property\WorstRatingProperty(
                                    new DataType\NumberType(1)
                                )
                            )
                    )
                )
                ->setAuthor(
                    new Property\AuthorProperty(
                        (new Type\PersonType())
                            ->setName(
                                new Property\NameProperty(
                                    new DataType\TextType('Ellie')
                                )
                            )
                    )
                )
                ->setDatePublished(
                    new Property\DatePublishedProperty(
                        new DataType\DateType('2011-04-01')
                    )
                )
                ->setDescription(
                    new Property\DescriptionProperty(
                        new DataType\TextType('The lamp burned out and now I have to replace it.')
                    )
                )
                ->setName(
                    new Property\NameProperty(
                        new DataType\TextType('Not a happy camper')
                    )
                )
            ,
            (new Type\ReviewType())
                ->setReviewRating(
                    new Property\ReviewRatingProperty(
                        (new Type\RatingType())
                            ->setBestRating(
                                new Property\BestRatingProperty(
                                    new DataType\NumberType(5)
                                )
                            )
                            ->setRatingValue(
                                new Property\RatingValueProperty(
                                    new DataType\NumberType(4)
                                )
                            )
                            ->setWorstRating(
                                new Property\WorstRatingProperty(
                                    new DataType\NumberType(1)
                                )
                            )
                    )
                )
                ->setAuthor(
                    new Property\AuthorProperty(
                        (new Type\PersonType())
                            ->setName(
                                new Property\NameProperty(
                                    new DataType\TextType('Lucas')
                                )
                            )
                    )
                )
                ->setDatePublished(
                    new Property\DatePublishedProperty(
                        new DataType\DateType('2011-03-25')
                    )
                )
                ->setDescription(
                    new Property\DescriptionProperty(
                        new DataType\TextType('Great microwave for the price. It is small and fits in my apartment.')
                    )
                )
                ->setName(
                    new Property\NameProperty(
                        new DataType\TextType('Value purchase')
                    )
                )
            ,
        ])
    )
;
```

The output:

```
{"@context":"http:\/\/schema.org","@type":"Product","aggregateRating":{"@type":"AggregateRating","reviewCount":11,"ratingValue":3.5},"offers":{"@type":"Offer","availability":"https:\/\/schema.org\/InStock","price":55,"priceCurrency":"USD"},"review":[{"@type":"Review","reviewRating":{"@type":"Rating","bestRating":5,"ratingValue":1,"worstRating":1},"author":{"@type":"Person","name":"Ellie"},"datePublished":"2011-04-01","description":"The lamp burned out and now I have to replace it.","name":"Not a happy camper"},{"@type":"Review","reviewRating":{"@type":"Rating","bestRating":5,"ratingValue":4,"worstRating":1},"author":{"@type":"Person","name":"Lucas"},"datePublished":"2011-03-25","description":"Great microwave for the price. It is small and fits in my apartment.","name":"Value purchase"}],"description":"0.7 cubic feet countertop microwave. Has six preset cooking categories and convenience features like Add-A-Minute and Child Lock.","image":"kenmore-microwave-17in.jpg","name":"Kenmore White 17\" Microwave"}
```

Project tags
------------

[](#project-tags)

As you maybe noticed the bundle don't use the standard tag numeration flow. Each two first parts of the tag corresponds to the version of the schema from schema.org from which the mapping classed were generated.

The schema.org releases history can be found here:

Want to support this bundle?
----------------------------

[](#want-to-support-this-bundle)

Consider using our [random code generator](https://codito.io/) service at [codito.io](https://codito.io/).

With [codito.io](https://codito.io/) you can generate up to 250,000 codes in the format of your choice for free. You can use the generated codes for purposes such as promotional codes (which you can, for example, print on the inside of packaging), serial numbers, one-time or multi-use passwords, lottery coupons, discount codes, vouchers, random strings and much more - for more use cases see our [examples](https://codito.io/free-random-code-generator/examples). If 250,000 codes are not enough for you, you can use our [commercial code generation service](https://codito.io/commercial-code-generator/).

[![Random Code Generator](https://camo.githubusercontent.com/06fcfbee43d9df2084536628f12e31577a98295a02e20b428172133530864f8b/68747470733a2f2f636f6469746f2e696f2f6275696c642f66617669636f6e732f6c6f676f2e65353666376662312e77656270)](https://codito.io/)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~472 days

Recently: every ~749 days

Total

8

Last Release

116d ago

Major Versions

3.3.2 → 26.0.02024-05-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/16771e4f1b72d12f981ed61b585a74501530faf699086fb30b26ef6117399227?d=identicon)[secit](/maintainers/secit)

---

Top Contributors

[![secit-pl](https://avatars.githubusercontent.com/u/24696884?v=4)](https://github.com/secit-pl "secit-pl (24 commits)")

---

Tags

schema.org

### Embed Badge

![Health badge](/badges/secit-pl-schema-org/health.svg)

```
[![Health](https://phpackages.com/badges/secit-pl-schema-org/health.svg)](https://phpackages.com/packages/secit-pl-schema-org)
```

###  Alternatives

[api-platform/schema-generator

Various tools to generate a data model based on Schema.org vocables

4714.2M7](/packages/api-platform-schema-generator)[melbahja/seo

SEO library for PHP is a simple PHP library to help developers 🍻 do better on-page SEO optimizations.

355143.7k4](/packages/melbahja-seo)[brotkrueml/schema

Embedding schema.org vocabulary - API and view helpers for schema.org markup

33584.6k13](/packages/brotkrueml-schema)[brick/schema

Schema.org library for PHP

5163.7k1](/packages/brick-schema)[crwlr/schema-org

Extract schema.org structured data from HTML documents.

1519.9k1](/packages/crwlr-schema-org)

PHPackages © 2026

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