wt-health/laravel-json-schema-request
A Laravel package for validating incoming requests against JSON Schema definitions. Define schemas once, keep controllers clean, and get precise, standards-based validation errors for your API or application requests.
FormRequest validate the raw request payload against a JSON Schema document rather than hand-written rule arrays. That is a lever for deciding whether JSON Schema / OpenAPI artifacts become the source of truth for your API surface, or stay as documentation that drifts from the code.$ref resolution, error mapping, version tracking) against a pinned dependency.Adopt when:
oneOf/anyOf, $ref reuse, deeply conditional payloads, or schema shapes shared with a non-PHP service.Look elsewhere when:
FormRequest rules and Laravel's default validation responses are cheaper and better documented.errors bag UX out of the box and don't want to own the mapping from schema violations to your error format.For executives: this is a small, low-cost dependency that lets our API enforce the same contract document we publish to partners and client teams. The business value is fewer integration defects and less time reconciling "what the docs say" against "what the API accepts" — a recurring cost in every partner integration. It is not a new platform; it is a validation layer inside Laravel. The one governance ask: it ties our framework upgrade cadence to the package's release cadence (v4 requires Laravel 12+, and drops Laravel 11), so it belongs in upgrade planning rather than being adopted silently.
For engineering: a FormRequest subclass that validates the request body against a JSON Schema instead of an inline rules array, giving us $ref reuse, composition keywords, and a single contract artifact shared with other services. It is a thin layer over Laravel's existing request lifecycle — no new runtime, no new infrastructure. Two caveats to plan for in v4.0.0: Laravel 11 support is removed (pin v3.2.0 if we're not upgrading), and failed authorization now returns 403 instead of the previous status — audit client-side handling and our API error documentation before we ship the bump. Treat the major version as a coordinated upgrade, not a routine composer update.
How can I help you explore Laravel packages today?