hrombach/json-validation-bundle
A Symfony bundle for validating JSON payloads against configurable rules and schemas, helping you reject malformed data early and surface clear, structured errors before it reaches your application logic.
Architecture fit
HeroJsonValidationBundle), registered via AppKernel/bundles.php and configured through a DependencyInjection extension. In a Laravel codebase there is no bundle kernel to register it with, so the integration surface simply does not exist. Adoption in Laravel would mean bypassing the bundle wrapper entirely and pulling the underlying library.justinrainbow/json-schema. It contributes no validation logic of its own; its only value is DI registration and possibly a config-driven schema path. Any architectural benefit is therefore bounded by the underlying library, which is independently installable.composer require directly, does the bundle justify a dependency at all?Integration feasibility
composer.json (symfony/symfony: ~2.x, justinrainbow/json-schema: ~1.x), which conflict with Symfony 6/7 (symfony/framework-bundle ^6|^7) and PHP 8.1+.AbstractBundle, attribute-based config, removal of getRootNode conventions). A 2013-era extension will likely fail to compile on modern kernels.Technical risk
justinrainbow/json-schema major is a real vulnerability-adjacent concern (that library had CVEs in older lines around $ref resolution / remote schema fetching).justinrainbow; no JSON Schema 2019-09/2020-12 support. If product requirements include modern schema features (unevaluatedProperties, $dynamicRef), this is a dead end.$ref resolution against remote or local registries? Is schema validation on the request path (latency-sensitive) or in async consumers?Verdict on the wrapper
Do not adopt the bundle. If JSON Schema validation is required, evaluate opis/json-schema (modern drafts, actively maintained, framework-agnostic) or justinrainbow/json-schema directly at a current major. In Laravel, wrap whichever library we choose in a first-party service provider — roughly the same effort as retrofitting this bundle, with a maintainable upgrade path.
Stack fit
composer require justinrainbow/json-schema (or opis/json-schema) directly and binding a validator service in a first-party provider. Recommended pattern: a JsonSchemaValidator contract in app/Support (or a small internal package), resolved via the container, injected into FormRequests, jobs, and webhook handlers.Migration path
$ids, drafts, $ref graph).validate(array $payload, string $schemaRef): ValidationResult) so the engine is swappable.JsonSchema) for request-level use and as a job middleware for consumer-side use.Compatibility
justinrainbow/json-schema itself is usable on modern PHP, but check the pinned major for PHP 8.2/8.3 deprecations and $ref remote-fetch behavior (disable remote resolution explicitly in config to avoid SSRF in webhook paths).Sequencing
opis/json-schema vs justinrainbow against our actual schema corpus; produce a compatibility matrix on draft support and $ref handling.Maintenance
opis/json-schema is actively maintained; justinrainbow is stable but slower-moving. Either is a defined, tractable dependency.Support
Scaling
$ref resolution: remote refs introduce network I/O and latency variance. Resolve locally or pre-bundle schemas at build time.Failure modes
$ref failure/SSRF: a validator that fetches refs becomes an outbound-request vector. Disable remote resolution and pin a local loader.format as assertion vs annotation). Pin majors and cover with fixture-based regression tests.Ramp-up
opis/json-schema first) and a first-party Laravel adapter.How can I help you explore Laravel packages today?