Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. JSON
  3. JSON Schema for PHP

JSON Schema for PHP

MITPHP6.10.0

A PHP implementation for validating JSON structures against JSON Schema drafts 3, 4, 6, and 7.

Visit WebsiteGitHubGitHub
3.6k stars369 forks0 contributors

What is JSON Schema for PHP?

JSON Schema for PHP is a library that validates JSON data structures against JSON Schema specifications. It allows PHP developers to ensure that JSON input, configuration files, or API payloads conform to expected formats and constraints defined in a schema. The library supports multiple JSON Schema drafts and includes features like type coercion and default value application.

Target Audience

PHP developers building applications that consume JSON data, such as REST APIs, configuration systems, or data processing pipelines requiring strict structural validation.

Value Proposition

Developers choose this library for its robust compliance with JSON Schema standards, support for multiple drafts, and practical features like type coercion and default application that simplify validation of real-world data like HTTP requests.

Overview

JSON Schema for PHP

Use Cases

Best For

  • Validating API request payloads in PHP applications
  • Ensuring configuration files adhere to a defined schema
  • Data integrity checks for JSON-based data pipelines
  • Automated testing of JSON structures against specifications
  • Coercing HTTP request parameters to typed values
  • Applying default values to incomplete JSON documents

Not Ideal For

  • Projects requiring validation against JSON Schema Draft 2019-09 or later for features like dynamic references or vocabularies
  • Applications where data integrity without modification is paramount, as type coercion and default application alter input data
  • High-throughput systems needing ultra-fast validation, as the library's feature-rich nature may introduce performance overhead
  • Teams using modern PHP frameworks with integrated validation solutions that prefer dependency minimization

Pros & Cons

Pros

Broad Draft Compatibility

Supports JSON Schema drafts 3, 4, 6, and 7, making it versatile for validating schemas from various eras without needing multiple libraries, as evidenced by the compliance badges in the README.

Practical Type Coercion

Automatically converts HTTP request strings to typed values like booleans and numbers using CHECK_MODE_COERCE_TYPES, simplifying validation in web applications where input is often string-based.

Default Value Application

Applies schema-defined defaults to missing properties during validation with CHECK_MODE_APPLY_DEFAULTS, reducing manual data handling and ensuring completeness in JSON documents.

Flexible Validation Modes

Offers configurable flags like strict mode, exception throwing, and format disabling, allowing developers to tailor validation behavior to specific needs, as detailed in the configuration options table.

Cons

Outdated Draft Support

Lacks support for newer JSON Schema drafts (2019-09, 2020-12), limiting access to modern features, and the README explicitly warns that newer draft features might not be supported.

Data Modification Side Effects

Type coercion and default application modify the original data, which the README notes can lead to unexpected changes, requiring careful management in sensitive applications.

Complex Reference Setup

Inline reference resolution requires additional setup with SchemaStorage and Factory, adding complexity and boilerplate code compared to simpler validation libraries or built-in solutions.

Frequently Asked Questions

Quick Stats

Stars3,630
Forks369
Contributors0
Open Issues14
Last commit3 days ago
CreatedSince 2011

Tags

#api-validation#php-library#schema#data-integrity#schema-validation#json-schema#json-validation#data-validation#composer-package#json

Built With

P
PHP

Links & Resources

Website

Included in

JSON1.5k
Auto-fetched 13 hours ago

Related Projects

ajvajv

The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

Stars14,780
Forks1,003
Last commit2 months ago
jsonschemajsonschema

An implementation of the JSON Schema specification for Python

Stars4,966
Forks641
Last commit1 day ago
Ruby JSON Schema ValidatorRuby JSON Schema Validator

Ruby JSON Schema Validator

Stars1,645
Forks247
Last commit19 days ago
tv4tv4

Tiny Validator for JSON Schema v4

Stars1,167
Forks181
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub