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 Introspector Laravel Package

radebatz/openapi-introspector

radebatz/openapi-introspector inspects OpenAPI/Swagger specifications at runtime, exposing endpoints, schemas, and metadata to Laravel and PHP apps. It helps generate documentation, validate APIs, and integrate specs into tooling with a clean, framework-friendly API.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit openapi-introspector is a build-time/documentation-plane tool, not a request-path dependency. It derives an OpenAPI document by introspecting the framework's route table and merging in explicitly declared operations (PHP 8 attributes, and — per the "classic operations" wording in 1.0.1 — annotation-style definitions in the swagger-php tradition). For a Laravel codebase this is architecturally low-risk: it consumes the router and reflection metadata that already exist, and its only output is a generated artifact. It does not sit in the hot path, does not own persistence, and imposes no runtime contract on application code.

Integration feasibility Straightforward in principle — a Composer dev dependency, a service provider, and a console command or CI step that emits openapi.json/yaml. The 1.0.1 changes are all evidence that the merge semantics between "routes we found" and "operations we were told about" are actively being hardened, which is the exact seam an integrator cares about:

  • Hybrid mode retention (PR #4) — classic/annotation-defined operations are not dropped when route introspection is also enabled. This is the single most important fix for teams migrating incrementally, because it means you can adopt introspection per-endpoint rather than all at once.
  • Positional path-parameter mapping (PR #5) — route placeholders are reconciled with attribute-declared path templates. Slightly fragile semantics (positional, not by name), so path templates whose placeholder names diverge from the route definition are a validation item for us.
  • Route/documentation collision precedence (PR #6) — documented operations win over route-derived ones. This gives us a deterministic override mechanism: declare an operation explicitly to correct or replace the inferred one.
  • Server URL prefix stripping (PR #7) — prevents doubled prefixes (/api/v1/api/v1/...) when servers[].url carries a base path. A correctness fix that directly affected whether generated specs were usable by gateway/codegen consumers.

Technical risk Moderate-low, but concentrated in two areas. First, supply chain and bus factor: this is a single-maintainer package at 1.0.x with a small change surface per release. A patch-level release carrying four behavioural corrections to merge logic implies the 1.0.0 semantics were not fully settled. Second, silent incorrectness: the failure mode of a spec generator is not a crash, it is a plausible-looking but wrong contract that downstream codegen and contract tests then trust. None of the 1.0.1 fixes are breaking, but each changes output for some inputs — so any snapshot of a previously generated spec may shift.

Key questions

  1. What is the supported matrix — Laravel 10/11/12, PHP 8.1+? Is the Laravel binding first-party or a thin adapter over a framework-agnostic core?
  2. Does it translate FormRequest rules / validation into request schemas, or only path/verb/parameter structure?
  3. How are security schemes (Sanctum, Passport, API keys) declared and attached — attribute-driven, config-driven, or out of scope?
  4. Is there a documented precedence table for hybrid mode now that PR #6 exists, and is positional parameter mapping documented as a constraint?
  5. What is the test story — golden-file specs in CI? Is spec output deterministic and stable enough to diff in a PR check?
  6. What is the upgrade/BC policy commitment for 1.x?

Integration Approach

Stack fit Assumes a conventional Laravel app or modular monolith with route files and controllers. Best fit is a team that already wants a code-first spec — routes and attributes as the source of truth — rather than a hand-maintained YAML document. It will compete with dedoc/scramble (zero-annotation, Laravel-native) and zircote/swagger-php (annotation-first); the differentiator here is the hybrid merge, which is attractive precisely because it avoids an all-or-nothing migration. If the team has already standardised on hand-written OpenAPI or on Scramble with no annotation appetite, the value proposition is weaker.

Migration path Adopt incrementally, exploiting hybrid mode:

  1. Install as require-dev, register the provider, run the generator against the current route table with introspection only. Treat the output as a report, not a contract — review it.
  2. Diff that report against any existing hand-maintained spec to size the gap. Where the inferred output is wrong or under-specified, add explicit operation declarations, relying on PR #6's documented-wins precedence.
  3. Cut the artifact over to being the published contract only once the diff is stable across two consecutive runs.
  4. Only then wire consumers (SDK codegen, gateway import, contract tests) to the generated file.

Compatibility Pin exactly (1.0.1) in the lockfile and treat 1.0.x bumps as reviewable events, since output-shape changes are landing in patch releases. Because the package is dev-only, rollback is a lockfile revert — no deploy required. Verify Laravel/PHP version support before committing; if the app is on an older LTS, confirm before piloting.

Sequencing Bounded pilot first: one bounded context or one route group, generating to an artifact in CI, with a checked-in golden file so spec drift becomes a visible PR diff. Expand coverage only after the merge behaviour (collisions, path parameters, server prefixes) has been observed to behave predictably on real routes. Gate any consumer-side codegen behind the pilot's stability window.

Operational Impact

Maintenance Low steady-state cost: one dev dependency, one command, one artifact. The real maintenance surface is the annotation/attribute layer in application code — that is where engineers will spend time, and it needs an owner and a convention (e.g. every new controller ships with its operation attributes). Budget for periodic review of generated-spec diffs, not for runtime upkeep.

Support External support is effectively "read the source and raise an issue" — single maintainer, small community. Internal support burden is therefore ours: nominate one engineer as the owner of the generator configuration and the golden-file test. Document the precedence rules (documented-beats-inferred, positional path-parameter mapping) in the team's API guidelines so failures are diagnosable without reading vendor code.

Scaling Generation cost scales with route count and is a CI-time concern only; for a few hundred routes this is negligible. The scaling risk is organisational, not computational: as more teams annotate, inconsistent conventions proliferate. Centralise shared components (schemas, security schemes, server definitions) rather than letting each module declare its own.

Failure modes

  • Spec drift — routes change, no one regenerates; consumers act on a stale contract. Mitigation: regenerate in CI and fail the build on an unexpected diff; publish artifact per build.
  • Silent misgeneration — an inferred operation looks valid but omits a parameter, wrong required flag, or wrong response shape. Mitigation: contract tests against the running app, plus review of the generated diff on any route-touching PR.
  • Merge precedence surprise — a documented operation silently shadows a route, or vice versa. PR #6 makes this deterministic; encode the rule in tests.
  • Upgrade regression — a 1.0.x bump changes output. Mitigation: exact pin, golden-file diff on upgrade PRs.
  • Bus factor — maintainer unavailability. Mitigation: fork-and-patch contingency, and keep the spec artifact reproducible from the repo so the tool is replaceable.

Ramp-up Small for the tool, moderate for the conventions. An engineer familiar with Laravel routing and OpenAPI can be productive in under a day. The genuinely novel concepts to teach are hybrid mode's two sources of truth and the override precedence — a short internal doc plus a reference controller covering path params, request schema, responses, and security is sufficient. Expect the first "why is my spec wrong" incident to be a path-parameter or server-prefix issue, since those are exactly the areas 1.0.1 was still correcting.

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator