Download the PHP package evabee/schema-org-json-ld without Composer

On this page you can find all versions of the php package evabee/schema-org-json-ld. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package schema-org-json-ld

schema-org-json-ld

PHP and TypeScript/JavaScript library for generating schema.org JSON-LD structured data for Google Rich Results. Covers all 31 Google Search Gallery categories backed by 89 schema classes/modules (88 primary schema types + 1 additional sub-type), with type-safe constructor-promoted properties and automatic serialization.

Validated against the Google Rich Results Test via the schema-org-json-ld-qc validation suite.

Tests PHP 8.1 PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5 TypeScript CI Node 20 Node 22 Node 24 npm


Table of Contents


Installation

TypeScript / JavaScript

PHP

Note: The vendor name evabee is intentional. Due to Packagist requiring excessive GitHub permissions, the default evalok vendor namespace is unavailable. The package is otherwise identical.


Quick Start

PHP

The pattern is always the same: instantiate a schema class, pass it to JsonLdGenerator::SchemaToJson(), and embed the result in a <script type="application/ld+json"> tag.

TypeScript / JavaScript


Supported Types

Google Rich Results category Supported schema types
Article Article, NewsArticle, BlogPosting
Breadcrumb BreadcrumbList, ListItem
Carousel ItemList, ListItem
Course Course, CourseInstance, Schedule
Dataset Dataset, DataDownload, DataCatalog, GeoShape
Discussion forum DiscussionForumPosting, Comment, InteractionCounter
Education Q&A Quiz, Question, Answer, AlignmentObject
Employer aggregate rating EmployerAggregateRating
Event Event, Place, VirtualLocation, Offer, EventStatusType, EventAttendanceModeEnumeration
FAQ FAQPage, Question, Answer
Image metadata ImageObject
Job posting JobPosting, Organization, Place, MonetaryAmount, AdministrativeArea, PropertyValue
Local business LocalBusiness, FoodEstablishment, Restaurant, Store, PostalAddress, GeoCoordinates, OpeningHoursSpecification, AggregateRating, Review, DayOfWeek
Math solver MathSolver, SolveMathAction
Movie Movie, Person, AggregateRating, Review
Organization Organization, PostalAddress, ContactPoint, MerchantReturnPolicy, MerchantReturnPolicySeasonalOverride, MemberProgram, MemberProgramTier, ShippingService, MerchantReturnEnumeration, RefundTypeEnumeration, ReturnFeesEnumeration, ReturnLabelSourceEnumeration, ReturnMethodEnumeration, TierBenefitEnumeration
Product Product, Offer, AggregateOffer, Brand, OfferShippingDetails, ShippingDeliveryTime, DefinedRegion, MonetaryAmount, QuantitativeValue, AggregateRating, Review, SizeSpecification, ProductGroup, PeopleAudience, Certification, UnitPriceSpecification, ShippingConditions, ServicePeriod, ShippingRateSettings, FulfillmentTypeEnumeration, OfferItemCondition, ItemAvailability
Profile page ProfilePage, Person, Organization
Q&A QAPage, Question, Answer
Recipe Recipe, Person, NutritionInformation, HowToStep, HowToSection, AggregateRating, VideoObject
Review snippet Review, AggregateRating, Rating, Thing
Software app SoftwareApplication, MobileApplication, WebApplication
Speakable SpeakableSpecification (via Article)
Subscription/paywalled content WebPageElement (via Article)
Vacation rental VacationRental, Accommodation, BedDetails, PostalAddress, AggregateRating, LocationFeatureSpecification
Video VideoObject, Clip, InteractionCounter, BroadcastEvent

Usage Examples

Article

Supports Article, NewsArticle, and BlogPosting. NewsArticle and BlogPosting extend Article and share the same constructor — only @type differs.

TypeScript:

Output is identical to the PHP JSON example above.

Use NewsArticle or BlogPosting by substituting the class name — the constructor is identical:


Breadcrumb

TypeScript:

Output is identical to the PHP JSON example above.


Carousel

Use ItemList with ListItem entries pointing to the URLs of items in the carousel (articles, recipes, movies, etc.).

TypeScript:

Output is identical to the PHP JSON example above.


Course

TypeScript:

Output is identical to the PHP JSON example above.


Dataset

TypeScript:

Output is identical to the PHP JSON example above.


Discussion Forum

TypeScript:

Output is identical to the PHP JSON example above.


Education Q&A

TypeScript:

Output is identical to the PHP JSON example above.


Employer Aggregate Rating

TypeScript:

Output is identical to the PHP JSON example above.


Event

TypeScript:

Output is identical to the PHP JSON example above.


FAQ

TypeScript:

Output is identical to the PHP JSON example above.


Image Metadata

TypeScript:

Output is identical to the PHP JSON example above.


Job Posting

TypeScript:

Output is identical to the PHP JSON example above.


Local Business

TypeScript:

Output is identical to the PHP JSON example above.


Math Solver

TypeScript:

Output is identical to the PHP JSON example above.


Movie

TypeScript:

Output is identical to the PHP JSON example above.


Organization

TypeScript:

Output is identical to the PHP JSON example above.

hasMerchantReturnPolicy, hasMemberProgram, and hasShippingService accept MerchantReturnPolicy, MemberProgram, and ShippingService objects respectively (or arrays of those objects).

Additional organization identifier fields supported by Organization:


Product

TypeScript:

Output is identical to the PHP JSON example above.


Profile Page

TypeScript:

Output is identical to the PHP JSON example above.


Q&A

TypeScript:

Output is identical to the PHP JSON example above.


Recipe

TypeScript:

Output is identical to the PHP JSON example above.


Review Snippet

TypeScript:

Output is identical to the PHP JSON example above.

Review and AggregateRating are typically embedded inside a Product, Movie, Recipe, etc. rather than used standalone. The review and aggregateRating properties are available on all relevant schema types.


Software App

Supports SoftwareApplication, MobileApplication, and WebApplication. The subtype classes share the same constructor as SoftwareApplication.

TypeScript:

Output is identical to the PHP JSON example above.

Use MobileApplication or WebApplication by substituting the class name:


Speakable

The SpeakableSpecification is used via the speakable property on Article (and its subtypes).

TypeScript:

Output is identical to the PHP JSON example above.


Subscription / Paywalled Content

Mark paywalled content using WebPageElement via the hasPart property on Article.

TypeScript:

Output is identical to the PHP JSON example above.


Vacation Rental

TypeScript:

Output is identical to the PHP JSON example above.


Video

TypeScript:

Output is identical to the PHP JSON example above.

Multiple Schemas per Page (@graph)

When a page contains multiple rich result entities (for example an Article and a BreadcrumbList), you can combine them into a single JSON-LD block using @graph.


API Reference

PHP: JsonLdGenerator::SchemaToJson(TypedSchema $schema): string

Serializes any schema object to a JSON-LD string ready to embed in HTML.

Behaviour:

TypeScript: JsonLdGenerator.schemaToJson(schema: TypedSchema): string

TypeScript uses the same serialization behavior with a lowercase schemaToJson method name:

TypeScript: JsonLdGenerator.schemasToJson(...schemas: TypedSchema[]): string

Use this variant to generate an @graph payload from multiple schema objects:

TypedSchema (abstract base class)

All schema classes extend TypedSchema.

The only requirement is that each class defines the schema type constant/property:

For schema.org properties that use names that are not valid language identifiers (for example mathExpression-input), define a property map:

Schema classes use constructor promotion — all data is passed via the constructor and stored as public properties. No methods are needed beyond the constructor.


Testing

See the php/test/unit and ts/test directories for the full test suites.


Known Validator Limitations

When validating JSON-LD output with third-party validators (such as the Adobe Structured Data Validator), you may encounter warnings for certain properties. These are validator limitations, not library bugs — the generated output is valid schema.org JSON-LD and passes Google's Rich Results Test.

datePublished warnings

The following types may trigger a datePublished warning in some validators, despite datePublished being a valid schema.org property inherited from CreativeWork:

Recipe optional property warnings

These valid schema.org properties on Recipe may be flagged as "unsupported" by some validators:

These properties are defined on schema.org and are correctly serialized by this library. The warnings come from validators that maintain an incomplete allowlist of properties per type.


Contributing

Contributions are welcome! Please:

  1. Fork the repository and create a feature branch.
  2. Add or update schema classes in php/src/v1/Schema/ (PHP) or ts/src/schema/ (TypeScript).
  3. Write tests in php/test/unit/ (PHP) or ts/test/schema/ (TypeScript).
  4. Run composer run cs-fix and composer run test-unit for PHP changes.
  5. Run npm run test, npm run build, and npx biome check for TypeScript changes.
  6. For TypeScript schema additions, follow the options-object constructor pattern and update barrel exports in ts/src/index.ts.
  7. Open a pull request with a clear description of the change.

When adding a new schema type, follow the existing language-specific patterns: PHP classes extend TypedSchema and set A_SCHEMA_TYPE; TypeScript classes extend TypedSchema, set schemaType, and use options-object constructors.


License

MIT — see LICENSE.


All versions of schema-org-json-ld with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package evabee/schema-org-json-ld contains the following files

Loading the files please wait ...