Download the PHP package oihana/php-schema without Composer

On this page you can find all versions of the php package oihana/php-schema. 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 php-schema

Oihana PHP - Schema

Oihana PHP Schema

Oihana Schema is a PHP library that provides an object-oriented implementation of the Schema.org vocabulary. It is designed to encapsulate structured data using strongly typed value objects, with automatic serialization and hydration features.

Latest Version
Total Downloads

This library is ideal for representing database records or REST API resources in a structured, semantically rich way, compatible with JSON-LD and linked data ecosystems.

โœจ Key Features

๐Ÿ“ฆ Installation

Requires PHP 8.4+

Install via Composer:

๐Ÿš€ Quick Example

Simple usage

JSON-LD output

๐Ÿ—‚๏ธ Schemas overview

The library exposes three top-level namespaces. Each row below links to a dedicated wiki guide (English / Franรงais) that lists the classes, gives a code example and points to the source.

Namespace What it covers Classes Wiki guide
org\schema Full Schema.org vocabulary โ€” typed value objects for Thing, Person, Place, Event, Product, Offer, the complete Action hierarchy, creative works, organizations, services, enumerations. ~400 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\auth OAuth2/OIDC clients, sessions, keyfiles, users, roles, permissions, RBAC policies, Casbin helpers, JWT claims registry. 15 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\business Account โ†” business-world link: BusinessIdentity (typed account/entity link) and UserProfile (creation-time provisioning template). 2 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\business\documents The quote โ†’ purchase order โ†’ invoice cycle (and its neighbors): BusinessDocument (common parent), Quote, PurchaseOrder, Invoice, CreditNote, DebitNote, DeliveryNote, GoodsReceiptConfirmation, Receipt, RemittanceAdvice, Statement/StatementEntry, the BusinessDocumentExporter/JsonLdExporter export layer, plus the cross-cutting value objects TaxDetail, Adjustment, EcoFeeRule/AppliedEcoFee, DocumentTotals, BusinessDocumentLine, PaymentSchedule/PaymentInstallment/PaymentReminder, DeliveryLine/ProofOfDelivery, GoodsReceiptLine, AgingSummary. 27 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\http Structured HTTP request metadata: UserAgentInfo (browser, OS, device class, bot flag). 1 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\organizations Business entities: Company (French SIRET/APE identifiers, address + contact ingestion) and its Customer, Provider, Subsidiary, Affiliate flavors. 5 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\people Business contacts: Person and its typed flavors Seller, CustomerEmployee, Employee, ProviderEmployee, SubsidiaryEmployee. 6 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\products Commerce layer: Product (eligible-quantity tree, unit-of-sale conversions, resolveUnitCode() hook) with StockLevel, TaxRate, PriceSegmentation, scoped PricingCondition/PricingConditionSelector rules, the customer-priced CustomerOffer, payment conditions, provider/warehouse information. 16 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\places Operational locations: Site, Office, Warehouse, JobSite. 4 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\shipping Standing shipping arrangements: DeliveryRouteAssignment โ€” which delivery route serves an address, on which days, in which order of passage. 1 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema\thesaurus SKOS concept trees on top of DefinedTerm: ThesaurusTerm, Concept, ProductCategoryTerm, ProductPriceCategoryTerm, ConceptScheme, Collection, OrderedCollection โ€” broader/narrower hierarchy, notes, cross-scheme mappings, collections โ€” the priced DeliveryMethodTerm and the recurring DeliveryRouteTerm, plus the registry layer (ThesaurusScheme, ThesaurusDomain). 11 ๐Ÿ‡ซ๐Ÿ‡ท FR
xyz\oihana\schema Cross-cutting Oihana types: Pagination, Log, AuditAction, audit enumerations. 3 + enums ๐Ÿ‡ซ๐Ÿ‡ท FR
com\progress\schema OpenEdge Progress SQL SYS% system catalog: tables, columns, indexes, views, users, privileges, constraints, sequences, triggers, procedures, data types. 16 ๐Ÿ‡ซ๐Ÿ‡ท FR

Every entity extends org\schema\Thing, so they all share the same JSON-LD serialization, hydration and ArangoDB metadata. Sub-namespaces override the CONTEXT constant so downstream consumers can tell them apart:

Namespace JSON-LD @context
org\schema https://schema.org
xyz\oihana\schema* https://schema.oihana.xyz
com\progress\schema https://schema.progress.com

๐Ÿง  Internal Architecture

Base class: Thing

All entities extend the base class org\schema\Thing, which includes common Schema.org and metadata properties, as well as serialization logic:

The ThingTrait handles:

Recursive Hydration

The internal Reflection::hydrate() method builds full object graphs from associative arrays, including nested value objects and union types:

`

๐Ÿ” Safe Property Access

The org\schema\constants\Schema class contains constant names for every property in the Schema.org ontology and its extensions:

Properties are grouped by logical trait namespaces (e.g. Thing, Person, Event, etc.) for auto-completion and modularity:

๐Ÿ“š Documentation

Two complementary sets of documentation are available:

While the wiki grows, you can also explore the following namespaces directly:

โœ… Running Unit Tests

To run all tests:

To run a specific test file:

๐Ÿงพ License

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).

๐Ÿ‘ค About the author

๐Ÿ› ๏ธ Generate the Documentation

We use phpDocumentor to generate the documentation into the ./docs folder.

Usage

Run the command :

๐Ÿงฉ Advanced Usage

Union-typed properties

Some properties accept multiple types. For instance, publisher may be a string, a Person, or an Organization.

Arrays and nested entities

You can compose objects with arrays of other entities, leveraging the public-typed properties.

JSON-LD metadata for ArangoDB

Base Thing supports ArangoDB-style metadata fields to facilitate graph storage: _key, _id, _rev, _from, _to.

Deep/recursive hydration

The constructor copies provided values into public properties.

For deep graphs and automatic casting, you can rely on the internal reflection utilities exposed by oihana/php-reflect (see developer docs). A typical approach is to call a reflection-based hydrate() to materialize nested arrays into value objects.

๐Ÿงฑ Extending the Library

Define your own types by extending org\schema\Thing or a more specific class, and add your public-typed properties. You can also define constants alongside org\schema\constants\Schema for safer access.

โš™๏ธ Installation Notes

๐Ÿค Contributing

Contributions are welcome! Please:

Local setup:

๐Ÿ”’ Security

If you discover a security vulnerability, please email [email protected]. Do not open a public issue for security reports.

๐Ÿ“œ Changelog

See CHANGELOG.md for notable changes.

๐Ÿ”— Related Packages

โ“ FAQ

๐Ÿงฎ JSON Schema Generation

Generate JSON Schemas from the typed public properties of your classes.

Experimental โ€” local tooling only. schemas/ is gitignored: the generated files are not committed and nothing in the library consumes them. Regenerate on demand. The generator is known to be incomplete (see Known limitations below) and its output should not be relied upon for validation yet.

Details:

Output layout and cleanup

Array unions handling

When a property type includes array plus other types (e.g. string|ImageObject|array<ImageObject|string>|null), the generator emits:

Known limitations

The generator has not been finished; the following are known and unfixed:


All versions of php-schema with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
oihana/php-core Version dev-main
oihana/php-enums Version dev-main
oihana/php-reflect Version dev-main
oihana/php-standards Version dev-main
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 oihana/php-schema contains the following files

Loading the files please wait ...