PHPackages                             melting-server/schema-dot-org-tree - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. melting-server/schema-dot-org-tree

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

melting-server/schema-dot-org-tree
==================================

Reads a version of schema.org and builds out a structured tree. Access any entry's direct or inherited properties or traverse the tree using $entity-&gt;parent() or $entity-&gt;children. Supports multiple schema versions.

1101PHP

Since Nov 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/melting-server/schema-dot-org-tree)[ Packagist](https://packagist.org/packages/melting-server/schema-dot-org-tree)[ RSS](/packages/melting-server-schema-dot-org-tree/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

About
=====

[](#about)

This library grabs and parses Schema.org into a structured array. If you're looking for a library that can help developers work with Schema in php, checkout out  as it includes goodies and shortcuts for working with schema within your IDE. This repo does NOT include the actual schema.org json - it will download it from  on demand.

Cache/Storage of the resulting structured tree should be handled by your application. This library downloads and parses the json data into a structured array with some object normalization - nothing more.

Install
=======

[](#install)

```
composer require melting-server\schema-dot-org-tree
```

Usage
=====

[](#usage)

Initialize:

```
include('./vendor/autoload.php');
use \schemaDotOrgTree\Tree;
```

Structured Schema Tree
----------------------

[](#structured-schema-tree)

Download a version of schema.org and process it into a structure:

```
//For the latest schema.org (default):
$tree = new Tree();

//For "all" of the latest schemas:
$tree = new Tree('5.0-all');

//For a specific version:
$tree = new Tree('3.7-core');
```

You can now access the structured tree:

```
var_dump($tree->getTree()); //Structured tree
```

Entities
--------

[](#entities)

Get an entity:

```
$entity = $tree->getEntity("http://schema.org/Thing");
```

Entities can have a parent Entity and may have children Entities:

```
$parent = $entity->getParent(); // returns Entity or null
$children = $entity->getChildren(); // returns Entity[] (the array might be empty)
```

You can test to see if an Entity exists anywhere in the tree:

```
$tree->isLocatable("http://schema.org/Thing");
```

Entities provide these public properties (not to be confused with the Entity's Schema Properties):

```
// The Entity Property            The schema.org "field"
public $id;                    // from "@id"
public $type;                  // from "@type"
public $supersededBy;          // from "http://schema.org/supersededBy"
public $comment;               // from "rdfs:comment"
public $label;                 // from "rdfs:label"
public $subClassOf;            // from "rdfs:subClassOf"
public $purlSource;            // from "http://purl.org/dc/terms/source"
public $owlEquivalentProperty; // from "http://www.w3.org/2002/07/owl#equivalentClass"
public $category;              // from "http://schema.org/category"
public $closeMatch;            // from "http://www.w3.org/2004/02/skos/core#closeMatch"

/** @var string $version */
public $version;

/** @var Entity[] */
public $children = [];

/** @var Property[] */
public $properties = [];
```

Properties
----------

[](#properties)

Get an entity's properties

```
$properties = $entity->getProperties();      //with inherited properties
$properties = $entity->getProperties(false); //without inherited properties
```

Properties provide these public properties

```
// The Entity Property            The schema.org "field"
public $id;                       // from @id
public $type;                     // from @type
public $domainIncludes = [];      // from http://schema.org/domainIncludes
public $rangeIncludes = [];       // from http://schema.org/rangeIncludes
public $comment = "";             // from rdfs:comment
public $label = "";               // from rdfs:label
public $purlSource;               // from http://purl.org/dc/terms/source
public $owlEquivalentProperty;    // from http://www.w3.org/2002/07/owl#equivalentProperty
public $subPropertyOf;            // from rdfs:subPropertyOf
public $category;                 // from http://schema.org/category
public $inverseOf;                // from http://schema.org/inverseOf
public $supersededBy;             // from http://schema.org/supersededBy

/** @var string */
public $version;

/** @var bool */
public $inherited;
```

Advanced Usage
==============

[](#advanced-usage)

Most developers should probably not need these things, but you're your own person.

Reader Data
-----------

[](#reader-data)

Access the underlying json data from schema.org via

```
$tree->reader->getJson();
```

Multiple Version Support
------------------------

[](#multiple-version-support)

You can get a list of the available versions with:

```
$tree->reader::VERSIONS
```

Currently supported versions:

- '3.1-core' =&gt; '',
- '3.1-all' =&gt; '',
- '3.2-core' =&gt; '',
- '3.2-all' =&gt; '',
- '3.3-core' =&gt; '',
- '3.3-all' =&gt; '',
- '3.4-core' =&gt; '',
- '3.4-all' =&gt; '',
- '3.5-core' =&gt; '',
- '3.5-all' =&gt; '',
- '3.6-core' =&gt; '',
- '3.6-all' =&gt; '',
- '3.7-core' =&gt; '',
- '3.7-all' =&gt; '',
- '3.8-core' =&gt; '',
- '3.8-all' =&gt; '',
- '3.9-core' =&gt; '',
- '4.0-all' =&gt; '',
- '4.0-core' =&gt; '',
- '5.0-all' =&gt; '',
- '5.0-core' =&gt; '',

```

With multiple trees in memory, you can retrieve specfic entities from specific versions.
```php
$tree->getEntityReference('latest', 'http://schema.org/Thing');

```

Each class/property/dataType is loaded with knowledge about which version from which it was loaded.

```
$entity->version;
```

Limitations
===========

[](#limitations)

Schema is designed to be extendable and is intentionally not a "universal schema" in that it was not created to cover all possible types of nouns and adjectives in existence. Rather, it tries to be vague enough that separate entities are only created when it would be useful to help a system's deeper understanding of a subject or its relationship to other subjects. This flexibility has allowed schema to be a strong definition but also allows it be weird (i.e. Volcanoes have fax numbers). When implementing schema, you'll need to decide how strict you will be in its implementation. I have made a few decisions to aid in the speed of processing versus completeness.

The most important limitation of this library is single-inheritance. A sports arena, for example, is both a civic structure and a sporting location. These instances are uncommon in schema-core (more consequential when using the entire schema scope) but do occur. This library picks the first parent listed and ignores the others. The purpose of this library is to represent Schema in a php array as a tree which does not support multiple-inheritance. If this preference seriously messes up the meaning of an entity, shoot me message. From the instances I've seen in 5.0-core, there is nothing substantially lost.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![jksteelman](https://avatars.githubusercontent.com/u/5976473?v=4)](https://github.com/jksteelman "jksteelman (8 commits)")

### Embed Badge

![Health badge](/badges/melting-server-schema-dot-org-tree/health.svg)

```
[![Health](https://phpackages.com/badges/melting-server-schema-dot-org-tree/health.svg)](https://phpackages.com/packages/melting-server-schema-dot-org-tree)
```

###  Alternatives

[liaison/revision

Seamless software updates library for CodeIgniter4 projects.

186.4k1](/packages/liaison-revision)

PHPackages © 2026

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