Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Json Validation Bundle Laravel Package

mrsuh/json-validation-bundle

A Symfony bundle for validating JSON documents against JSON Schema. Add schema-based validation to request payloads, forms, and APIs with a dedicated constraint and clear, actionable error messages.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — low for direct adoption, moderate for pattern reuse. The package is packaged as a Symfony bundle, not a framework-agnostic library. Its entry point (*Bundle class), DI extension, configuration tree, and request/response event subscribers are all bound to the Symfony kernel lifecycle. Laravel has no equivalent contract: bundles do not autoload, services.yaml is not consumed, and Laravel ships its own event dispatcher and container. The usable asset is the validation core — schema loading plus validation of decoded JSON payloads — not the integration layer. In a Laravel context, the equivalent surface is a middleware (request) and a test-time assertion (response), or a custom Rule object wired into FormRequests.

Integration feasibility — conditional. Two paths exist:

  • Extract the engine. Identify what the bundle wraps (verify whether it is opis/json-schema, justinrainbow/json-schema, or a bespoke validator) and depend on that directly, reimplementing ~100 lines of Laravel glue (middleware + service provider + exception handler mapping). Highest leverage, lowest dependency risk.
  • Install and bypass the bundle. Add the package but never register the bundle; instantiate the validator service manually. This drags in symfony/http-kernel, symfony/config, and symfony/dependency-injection — http-kernel is not a Laravel dependency, so this introduces a parallel HTTP kernel stack purely as a transitive cost.

Technical risk — elevated, concentrated in stewardship. 17 stars, 0 dependents, a single release cadence that stopped in March 2023. There is no evidence of testing against PHP 8.3/8.4 or Symfony 7, no security response process, and no downstream population to surface regressions. MIT licensing removes legal friction but not maintenance obligation. The codebase is small enough to audit in an afternoon, which materially lowers supply-chain risk — the exposure is abandonment, not malice.

Key questions to resolve before commitment

  1. Which JSON Schema draft is supported (04/06/07/2019-09/2020-12)? This determines whether we can reuse OpenAPI component schemas verbatim.
  2. Does response validation run in production or is it test-only? Production response validation is a latency tax with little runtime value.
  3. What is the error output shape, and can it be mapped cleanly into Laravel's 422 validation response contract?
  4. Does it support $ref resolution across files/URLs, and is remote $ref fetching disabled by default?
  5. Which maintainer owns the fork if we adopt it, and what is the review SLA?

Integration Approach

Stack fit. Laravel 10/11/12 pins Symfony components at ^6/^7. If the bundle requires symfony/http-kernel ^4|^5, Composer will either fail or force a downgrade of core Laravel dependencies — an unacceptable outcome. Verify the constraint set on a scratch branch before any design work; a resolution failure here ends the evaluation in under an hour.

Migration path. Treat this as a pattern adoption, not a package adoption, unless the spike proves otherwise:

  • Spike (1–2 days): install in a throwaway Laravel app, resolve the bundle's validator service manually, run it against three representative payloads, and capture the error format and dependency delta.
  • Decision gate: if the underlying engine is a maintained OSS schema validator, depend on it directly and write our own middleware. If it is bespoke, fork the repository into the org namespace and own it — do not depend on an unmaintained upstream transitively.
  • Rollout: schema authoring as source of truth → CI contract tests → shadow-mode request validation (log-only) → enforce on new endpoints only → response validation confined to the test suite.

Compatibility. Pin the forked package at an exact version, add a CI job that runs the full test suite against the current and next PHP minor, and record the supported draft in the composer manifest. Do not accept floating constraints on a package with zero dependents and no release in two years.

Sequencing. Schema-first, enforcement-last. Authoring schemas and wiring CI assertions is reversible and high-value; rejecting live traffic is not. Enforce per-endpoint behind a feature flag so rollback is a config change rather than a deploy.

Operational Impact

Maintenance. Assume fork-and-own. Budget 1–2 engineer-days per quarter for dependency bumps, PHP minor compatibility, and schema-engine security patches. Track upstream via a watch on the repository; if it stays dormant for another two release cycles, formally reclassify it as an internal library and remove the upstream link from the dependency graph.

Support. No vendor, no SLA, community-of-one. The internal runbook must cover: how schemas are versioned, how to read a validation failure, how to disable enforcement per route, and who approves schema changes. Escalation path terminates at the owning team, not at an upstream maintainer.

Scaling. Schema validation is CPU-bound and runs per request. Compile or cache validators at boot — recompiling a schema graph per request will dominate p95 on high-throughput endpoints. Watch payload size: decoding plus validating a multi-megabyte body has a memory cost that is easy to miss in load tests. Response validation should never run in production paths; it multiplies cost by response count and returns no runtime safety.

Failure modes.

  • Regex/$ref DoS — adversarial or careless schemas can produce catastrophic backtracking or unbounded recursion.
  • Remote $ref fetch — must be disabled, or validation becomes a network call and an SSRF vector.
  • 500s instead of 422s — an unhandled validator exception leaks as a server error; map to Laravel's validation response explicitly.
  • Schema drift — schemas diverge from actual payloads because enforcement is shadow-mode and nobody reads the logs. Mitigate with a weekly drift report and a hard exit criterion for shadow mode.
  • Silent pass-through — a misconfigured route validates nothing and nobody notices.

Ramp-up. One to two days for a mid-level engineer to become productive; the real cost is JSON Schema literacy (drafts, $ref semantics, composition keywords), which is a team-level skill investment of roughly a week and is transferable to OpenAPI work regardless of whether this package survives the evaluation.

Recommendation. Adopt the capability, not the bundle. Fund the two-day spike to identify the underlying schema engine; proceed only if it extracts cleanly into Laravel-native middleware. If extraction is not clean, the correct decision is a first-party middleware over a maintained schema validator, with this repository retained as a design reference.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager