Download the PHP package jolicode/structured-data without Composer
On this page you can find all versions of the php package jolicode/structured-data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jolicode/structured-data
More information about jolicode/structured-data
Files in jolicode/structured-data
Package structured-data
Short Description A PHP toolkit to validate and convert structured data: Schema.org and Google Rich Results validation, microdata/RDFa/JSON-LD extraction, and the W3C JSON-LD 1.1 algorithms.
License MIT
Homepage https://github.com/jolicode/structured-data
Informations about the package structured-data
Structured Data Toolkit
JSON-LD and schema.org for PHP
[](https://github.com/jolicode/structured-data/actions/workflows/ci.yml)
[](docs/json-ld.md#conformance)
[](phpstan.neon)
[](https://packagist.org/packages/jolicode/structured-data)
[](LICENSE)
Validate and process structured data in PHP: check that your schema.org markup is valid and eligible for Google Rich Results, from JSON-LD, microdata or RDFa, without leaving your process. It also ships an implementation of the W3C JSON-LD 1.1 algorithms that passes the official test suites. The W3C implementation report lists no other PHP processor.
Try it in your browser, or see it at work in redirection.io, which audits the structured data of every page it crawls with it.
Why this library
- Google Rich Results checks, offline: 36 types, including the rules Google only states in prose, applied to subtypes and nested entities.
- Exact JSON-LD 1.1: the W3C test suites pass, so documents are validated on what they mean, not on how they are written.
- One pipeline for JSON-LD, microdata and RDFa found in an HTML page.
- Safe on untrusted pages: no network request or file read unless you allow-list it, hostile input refused instead of crashing.
- Built for workers: bounded memory, about 13 ms for a heavy document (benchmarks).
- Actionable diagnostics: severity, path in the document, line range, and a link to the Google documentation.
- Auditable rules: generated from the official schema.org release and the Google documentation, drift-checked weekly.
How it compares
| Tool | What it does | Difference |
|---|---|---|
| Rich Results Test | Google eligibility check | Browser only, no API |
| Schema Markup Validator | schema.org vocabulary check | Browser only, no Google rules |
| spatie/schema-org | Writes JSON-LD | No validation: use this library to check its output |
| brick/schema, crwlrsoft/schema-org | Read structured data into PHP objects | Accept whatever they find, no validation |
| ml/json-ld, digitalbazaar/php-json-ld | JSON-LD 1.0 processors | 1.0 only, load remote contexts by default |
Installation
Requires PHP 8.4 or later, with the dom, json and libxml extensions.
Usage
Validate a page or a JSON-LD document
A few options:
More in the validator documentation: filtering diagnostics, merged nodes, the parsed tree, and the CLI.
Use the JSON-LD algorithms
Expansion, compaction, flattening and framing are available as Expander, Compactor,
Flattener and Framer:
See the JSON-LD documentation for the options and the conformance report.
Remote contexts
https://schema.org contexts are resolved from bundled files. Any other remote @context is
refused by default. To allow some hosts, install symfony/http-client and pass an
allow-list:
Read Loading remote contexts before widening the policy.
Contributing
See CONTRIBUTING.md for the setup, the QA commands and the vocabulary upgrade procedures.
License
This library is released under the MIT License. See the bundled LICENSE file for details.
All versions of structured-data with dependencies
ext-dom Version *
ext-json Version *
ext-libxml Version *
league/uri Version ^7.8
psr/log Version ^1|^2|^3
salsify/json-streaming-parser Version ^8.3
symfony/http-client-contracts Version ^3.0
