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

Openapi Laravel Package

php-openapi/openapi

PHP library for reading, validating, and writing OpenAPI 3.0 specifications. Parse JSON or YAML into an object model, resolve references, inspect paths and schemas, and generate updated spec files—useful for API tooling, docs, and governance.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API strategy: spec-first vs. code-first. This package gives our PHP services a programmatic read/write/validate layer over OpenAPI 3.0/3.1 documents, which is the prerequisite for treating the spec as the source of truth instead of a doc artifact generated after the fact.
  • Build vs. buy for internal API tooling. Instead of building a custom parser for OpenAPI YAML/JSON, $ref resolution, and schema validation, this replaces that work with an MIT-licensed dependency. The build cost we avoid is not the parser itself but the long tail: multi-file $ref graphs, 3.0 vs 3.1 drift, and schema validation edge cases.
  • CI/CD roadmap: contract enforcement. Enables a "spec is valid and non-breaking" gate in the pipeline — validating specs in CI, diffing against the last released version, and failing builds on breaking changes. This is a governance decision, not a feature.
  • SDK / client generation roadmap. Parsing specs into an object model is the first half of any client SDK, mock server, or Postman/Insomnia collection export. Decides whether we generate clients internally or buy a managed codegen product.
  • Documentation and developer-portal decisions. Whether to render docs from the spec (Redoc/Swagger UI pipelines) or maintain hand-written docs. The parser is the enabling dependency for the generated-docs path.
  • Gateway and middleware configuration. Generates route definitions, request validators, or gateway config from a spec, so API changes propagate without hand-editing infrastructure.
  • Not a runtime decision. This is a build-time/CI-time library, not a request-path middleware. It informs tooling roadmap, not application architecture.

When to Consider This Package

Consider it when:

  • We are on PHP/Laravel and need to parse, mutate, validate, or serialize OpenAPI 3.0/3.1 documents in application or build code — not just lint them from the CLI.
  • We need $ref resolution across multi-file specs, which is where naive json_decode approaches break down.
  • We want a PHP-native object model rather than shelling out to a Node/Java tool (openapi-generator, swagger-cli) from our build scripts — fewer runtimes in the pipeline is a real operational win.
  • We are building internal tooling: spec diffing, client stub generation, mock server seeding, docs pipeline, or API governance checks.
  • We need to round-trip a spec (read, modify programmatically, write back) — e.g., injecting version metadata, merging spec fragments, or normalizing vendor extensions.

Look elsewhere when:

  • Adoption footprint matters more than capability. The repository metrics here are thin — roughly 5 stars and zero listed dependents. That is a strong signal to run a paid spike and confirm the project's health, maintainer responsiveness, and release cadence before it becomes load-bearing. The upstream lineage of this library (the widely used cebe/php-openapi) has substantially more community traction; evaluate whether we should depend on that package directly, or treat this as a fork whose divergence we would have to own.
  • We need OpenAPI 2.0/Swagger support, or deep 3.1-only semantics — verify coverage against our actual spec corpus, not the README.
  • We need runtime request/response validation middleware. Use a Laravel-specific validation package instead; this library validates the spec, not live traffic.
  • We only need codegen. openapi-generator has broader language and template coverage than anything we would assemble on top of a parser.
  • We need a supported commercial SLA. MIT with a small maintainer base means we absorb upgrade risk. If the spec layer is business-critical, budget for a maintained fork or a vendor with support.

How to Pitch It (Stakeholders)

To executives: We can make the API specification the authoritative contract for our PHP services rather than documentation that drifts from reality. This is an MIT-licensed library, so cost of adoption is engineering time, not licensing. It unblocks three roadmap items at once: automated contract checks in CI, generated client SDKs, and generated developer documentation. The strategic value is reduced integration breakage and less manual API bookkeeping — the risk to manage is dependency health, which we address with a short evaluation spike and an internal wrapper so we are not locked in.

To engineering: php-openapi/openapi gives us a proper OpenAPI 3.0/3.1 object model in PHP — parse, inspect, mutate, validate, serialize, with $ref resolution for multi-file specs. It fits natively into our Laravel build and CI tooling without adding a Node or Java runtime to the pipeline. Two caveats to plan around: (1) the repository's visible adoption is low, so we should pin a version, run a spike against our real spec corpus, and check the issue tracker and release cadence before committing; (2) we should wrap it behind a thin internal adapter interface so a swap — to the upstream package or to a different parser — is a one-file change rather than a refactor. If the spike passes, this is a small, well-scoped dependency that removes a genuinely annoying category of bespoke code.

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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons