Validate, interpret, and work with JSON Schemas in PHP — fully compatible with the specifications.
Implements the official JSON Schema specification (Draft 3 and 4), ensuring predictable and reliable validation.
Simple, expressive API designed for modern PHP projects. Integrates easily into frameworks like Laravel, Symfony, and more.
Validate data against schemas with precision and speed, independently verified through the Bowtie compliance suite.
$schema = json_decode(file_get_contents('person.schema.json'));
$data = json_decode('{"name": "Alice", "age": 30}');
$validator = new \JsonSchema\Validator();
$validator->validate($data, $schema);
if ($validator->isValid()) {
echo "✅ The supplied JSON validates against the schema.\n";
} else {
echo "❌ JSON does not validate. Violations:\n";
foreach ($validator->getErrors() as $error) {
printf("[%s] %s\n", $error['property'], $error['message']);
}
}