schema-org

github.com/spatie/schema-org SEO & Web Analytics Open-source projectOpen source

Generate Schema.org structured data and JSON-LD with a fluent builder for schema types.

github.com/spatie/schema-org
schema-org homepage screenshot

About schema-org

spatie/schema-org is a PHP package that provides a fluent builder for Schema.org types and properties. Its classes are generated from Schema.org's JSON-LD standards file to cover the core vocabulary.

Types can be created through the Schema factory or with the new keyword, modified conditionally or with custom properties, and output as an array, JSON-LD script tag, or JSON string. There is no full API documentation, so type and property details must be checked in the source code or on schema.org.

Key features

  • Fluent builder for Schema.org types and properties
  • Create types via Schema factory or new keyword
  • Render output as array, JSON-LD script, or JSON
  • Access properties with array notation via ArrayAccess
  • Conditionally modify schemas with if method
  • Set and retrieve custom properties with methods
Best for: PHP developers adding Schema.org structured data and JSON-LD to their applications.
Good for
  • Generated from Schema.org standards file to cover core vocabulary
  • Classes and methods include documentation for quick reference
  • Supports array, script tag, and JSON output formats
Watch out for
  • No full API documentation for types and properties

schema-org at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 6, 2026 · Online when checked
Listed
Oct 5, 2026

schema-org alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in SEO & Web Analytics

Well-known listings from the same topic.

All 211

schema-org FAQ

How is the package installed?
Via Composer with `composer require spatie/schema-org`.
How can schema objects be output?
With toArray(), toScript(), echoing the object, or json_encode().
How are custom properties handled?
Use setProperty() to set a custom property and getProperty() to retrieve one, with an optional default value.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing