sixlive/laravel-json-schema-assertions
Validate JSON responses and payloads against JSON Schema definitions in your Laravel tests. Adds expressive assertions like assertJsonSchema so you can verify API structure and contracts with minimal setup.
What the package is: sixlive/laravel-json-schema-assertions is a dev-only Laravel testing utility that adds JSON Schema assertion helpers (e.g. assertJsonSchema) to Laravel's TestResponse, removing hand-written structural assertions from feature/API tests.
Architecture fit: Very narrow, intentionally so. It registers a service provider and extends the framework's test response macro surface — it does not touch application runtime, HTTP layer, persistence, or auth. That makes it architecturally inert in production and low-coupling in test code. The trade-off is that it is a "convenience over opis/json-schema" wrapper: the value is ergonomics, not unique capability, so the build-vs-buy calculation is genuinely close.
Integration feasibility: Straightforward. composer require --dev, optional config publish for schema path resolution, then a one-line assertion in existing tests. No application code changes, no migrations, no env vars. The realistic effort is in authoring/curating JSON Schema documents, not in wiring the package.
Technical risk: Low, and this release reduces rather than adds risk. v4.4.0 is a maintenance release with two changes: PHPUnit deprecation fixes (PR #33) and Laravel 12.x compatibility (PR #34, via Laravel Shift). There are no new features, no API changes, no deprecations, and no configuration changes — a patch/minor bump that is drop-in from v4.3.2. The residual risks are structural, not release-specific: single-maintainer project, a small contributor base, and a compatibility model that trails Laravel majors by community PR rather than by maintainer commitment. Laravel 12 support arriving via an automated Shift PR is a positive signal but also evidence that framework-major readiness is reactive.
Key questions for the maintainer/team:
opis/json-schema or justinrainbow/json-schema) is used, and what are the version constraints and known spec gaps?Stack fit: Appropriate for any Laravel 10–12 service with a versioned public API or contract-tested JSON responses. It is a poor fit for teams already standardizing on OpenAPI-driven contract testing (Schemathesis, Dredd, Pact) or on Pest architecture presets — in those cases it duplicates an existing validation layer and adds a second source of truth for response shape.
Migration path: v4.3.2 → v4.4.0 is a no-risk, drop-in upgrade; pin to ^4.4 in require-dev. Teams still on v3 should note that the v3→v4 line did involve namespace/API changes and a config reshuffle, so that jump needs a dedicated branch and a test-suite run. The genuinely expensive migration is not the package upgrade but the schema authoring: converting existing ad-hoc assertJsonStructure/assertJsonCount assertions into schema files is where the effort lands, and it should be scoped as test-debt remediation rather than as a dependency bump.
Compatibility: The Laravel 12 compatibility in this release is the headline item — it unblocks adoption of Laravel 12 for any team that has this package in its dev dependency set, and conversely it was likely a hard blocker for upgrading (composer conflicts on illuminate/* constraints would have forced a removal or a fork). The PHPUnit deprecation fix reduces noise in CI output and lowers the chance of a hard break at the next PHPUnit major. Verify the package's own constraints resolve cleanly against your locked phpunit/phpunit, pestphp/pest, and laravel/framework versions before rollout.
Sequencing:
^4.4 in require-dev on a branch; run the full suite to confirm no assertion regressions from the PHPUnit changes.Maintenance: Near-zero ongoing cost — dev-only dependency, no runtime footprint, no security surface in production artifacts. The real maintenance burden is the schema corpus: schemas are code, they need review, versioning alongside API changes, and occasional refactoring. Budget for that ownership explicitly (an API platform or backend guild) or the schemas will silently rot and produce false confidence.
Support: Community-supported, single primary maintainer. Acceptable for a test-only dependency where failure mode is a red build, not an outage. Not acceptable as a critical-path dependency for compliance-driven contract guarantees without an internal fork plan.
Scaling: Negligible. Validation runs only in test processes; cost is proportional to the number of assertions and schema complexity, which can add measurable seconds to large suites. Mitigate with parallel test execution and by asserting schemas at the contract boundary rather than on every fixture. No horizontal scaling concerns.
Failure modes:
additionalProperties: false, required-nullable confusion) cause brittle failures and eventual bypassing of the assertion.Ramp-up: Trivial for anyone already writing Laravel feature tests — a single new assertion method plus JSON Schema familiarity. Allow roughly half a day to a day per engineer, plus a shared internal example/schema template so the team converges on one style rather than five. The scarce skill is JSON Schema authoring discipline, not the package itself; invest the onboarding time there, not in the API surface.
How can I help you explore Laravel packages today?