justinrainbow/json-schema
Validate JSON documents against JSON Schema in PHP. Supports Draft-3, Draft-4, Draft-6 and Draft-7 (coverage varies). Install via Composer and use JsonSchema\Validator to validate data with local file $ref schemas and inspect validation errors.
.env derivatives, Kubernetes manifests) against schemas to catch misconfigurations early.Adopt if:
"true" strings to booleans) or default value injection.Look elsewhere if:
ajv instead.evert-php/json-schema for stricter Draft-7 support.jsonschema (Python) or ajv (JS).spatie/laravel-json-schema-validator (Laravel-specific wrapper)."This package lets us automate data validation across APIs, databases, and configs, reducing bugs and compliance risks. For example, it can reject malformed API requests before they hit our services, saving dev time and improving reliability. It’s actively maintained, supports modern standards (Draft-7), and integrates seamlessly with Laravel—no reinventing the wheel. The cost? Minimal: a one-time composer require and a few hours to define schemas. The ROI? Fewer production incidents and faster onboarding for new integrations."
*"justinrainbow/json-schema gives us a battle-tested validator for JSON Schema (Draft-3 to Draft-7) with PHP/Laravel. Key perks:
\"true\" to true or \"17\" to 17 (saves manual parsing).processRefund: true if omitted).$ref links early).'email': 'Invalid format').Trade-offs:
Proposal:
app/Http/Controllers (e.g., wrap request()->all()).Model::create()).config/validation-schemas.php)."*Call to Action:
/api/v1/webhooks endpoint—it’s our highest-risk data source."How can I help you explore Laravel packages today?