radebatz/openapi-verifier
A Laravel package for verifying your API against an OpenAPI specification, helping keep routes, requests, and responses in sync with your docs and catching contract mismatches early in development or CI.
Architecture fit. This is a verification/contract-conformance tool, not a runtime feature. Its highest-value placement in a Laravel estate is the HTTP test layer: assert that real TestResponse output actually matches the published OpenAPI document, so the spec and the implementation cannot drift silently. The PSR-15 middleware and Guzzle/PSR-18 client decorators are secondary modes — useful for consumer-side checks against third-party APIs in integration tests, but they should not be treated as production traffic guards. It complements Laravel's request validation and tools like Scramble or knuckles; it does not replace either.
Integration feasibility. Moderate and self-contained. Requirements are an OpenAPI 3.0.x document held in-repo, a PSR-7/PSR-17 implementation, and the transitive league/openapi-psr7-validator. The Laravel adapter (response assertion against the spec) is the genuine differentiator — few packages offer that ergonomics. Exit cost is low because the package is a thin adapter over the league validator; if needed, we can call the underlying validator directly or write our own trait in under a day.
What changed in 2.2.3 (reviewed release). Patch-level, non-breaking, no deprecations, no API surface changes. Two items are relevant to us: (a) CI now runs against the 2.x branch, which tells us the 2.x line is actively maintained but also that it is being treated as a maintenance branch — expect the next capability work (notably OpenAPI 3.1 / JSON Schema 2020-12) to land in a future major; (b) YAML specifications are now explicitly supported via a suggested symfony/yaml dependency, with a clear error message when a YAML spec is supplied without it. The release notes point at github.com/DerManoMann/openapi-verifier — the upstream repository — which is corroborating evidence that published tags track upstream rather than a divergent fork tree.
Technical risk.
DerManoMann/openapi-verifier repository, so tag provenance is now better evidenced. Still confirm whether the Laravel adapter layer is upstream code or fork-only (i.e., will it survive the next upstream major).TestResponse internals have shifted across Laravel 9→12; a single-maintainer package will lag major releases.Key questions for the maintainer/team.
Stack fit. Laravel 10–12 on PHP 8.1+, PHPUnit or Pest, plus a PSR-7 implementation (verify whether one is already present transitively via the HTTP client; if not, add nyholm/psr7 explicitly). Consumer-side use requires a Guzzle or PSR-18 client already in the stack — common in service-to-service integrations. If the spec is authored in YAML (increasingly the default for OpenAPI in most repos, and now explicitly supported as of 2.2.3), add symfony/yaml to require-dev; a JSON spec keeps the dependency count at zero.
Migration path. Add as a require-dev dependency only, pinned to 2.2.3. No production code paths, no config publishing, no migrations. If the package is later abandoned, removal is a one-line composer change plus deletion of the assertion calls.
Compatibility considerations.
2.2.3) and commit the lockfile; do not float, and do not allow ^2 to carry us into a 3.x without review.$ref resolution needs checking; keep the spec self-contained if possible to avoid suite failures from path resolution rather than real defects.Sequencing.
The 2.2.3 changes do not alter this path; steps 1–2 proceed unchanged.
Maintenance. Near-zero production footprint; the burden is dependency hygiene — quarterly review of upstream activity (watch specifically for a 3.x / OpenAPI 3.1 announcement, since 2.x is now a maintenance branch), Laravel compatibility against our next major upgrade, and a standing decision to fork internally if the maintainer goes quiet. Budget roughly half a day per quarter plus a half-day at each Laravel major.
Support. No commercial support, no SLA, community issues only. Acceptable precisely because the blast radius is a dev dependency. The internal wrapper trait is our insurance policy.
Scaling. Validation is not free — parsing the spec and validating large response bodies adds seconds per test. On a suite of hundreds of HTTP tests this compounds. Mitigations: scope to critical endpoints rather than all of them, reuse a parsed spec instance across tests where the package permits, and keep large fixture payloads out of the validated set. Do not put this in the runtime request path; the latency and failure-handling trade-offs are not worth it.
Failure modes to plan for.
additionalProperties) can pass responses that violate intent. Do not present a green run as full contract assurance.TestResponse coupling and the gate quietly stops running. Add a canary assertion that is known to fail if the harness is not wired up.Ramp-up. Low for anyone who has read an OpenAPI document — roughly one day to first meaningful assertion, with the real effort spent on spec ownership and gate policy rather than tooling.
TPM recommendation. Adopt narrowly as a dev-only contract-conformance check behind an internal wrapper, pinned to 2.2.3, gated to a critical endpoint subset, with an explicit abandon-and-vendor trigger. The 2.2.3 release is a positive maintenance signal (active CI on the line, a real usability fix, clearer provenance) but does not change the fundamentals: single maintainer, minimal adoption evidence, and a known 3.1 gap. The low exit cost and the scarcity of Laravel-native TestResponse assertions still argue for a cheap, bounded pilot rather than broad rollout or any production-path use.
How can I help you explore Laravel packages today?