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

Laravel Swagger Laravel Package

ronasit/laravel-swagger

Generate Swagger/OpenAPI documentation for your Laravel API directly from annotations in your controllers, with automatic route discovery, a bundled UI, and support for the OpenAPI spec.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What this package is (as evidenced by 3.3): ronasit/laravel-swagger is a Laravel package that introspects application routes/controllers and produces an OpenAPI/Swagger specification, then serves an interactive docs UI. The 3.3 changelog confirms it performs static/reflective analysis of controllers (including invokable controllers and DI-bound contracts), understands Eloquent relation query parameters (with[], with_count[]), validates generated specs, and persists generated artifacts to storage drivers.

Architecture fit: Strong fit for Laravel monoliths and modular Laravel APIs where routes, controllers, and API Resources are the source of truth. It is a build-time/documentation-plane concern, not a request-path dependency — it does not sit in the hot path of the API it documents, which keeps blast radius low. Teams already on Laravel's container/route conventions get documentation "for free" relative to hand-written OpenAPI YAML, which is the core value proposition.

Integration feasibility: Low-to-moderate. Standard Composer install + config publish + a generation command; UI serving is opt-in. The 3.3 fixes materially reduce friction:

  • Invokable controllers with DI via contracts (PR #176) — previously a correctness gap for modern single-action controller patterns; now addressed.
  • Versioned API documentation fix (PR #189) — versioned route prefixes (/api/v1, /api/v2) are common in Laravel; this removes a known doc-generation defect.
  • Local storage driver fix (PR #187) — artifact persistence now works without requiring an external disk.
  • with[]/with_count[] expansion into discrete query params (PR #198) — generated specs become accurate for relation-inclusion APIs, reducing manual spec patching.

Technical risk:

  1. OpenAPI 3.0 validation alignment (PR #203, SwaggerService/SwaggerSpecValidator) — the highest-impact item. Tightening validator behavior against the OpenAPI 3.0 spec can turn previously "passing" generated specs into failures. If your CI gates on spec validation, expect new failures that reflect real spec defects rather than package regressions — but the failure will appear at upgrade time, not at code-change time. Confirm whether the target is 3.0.x vs 3.1.x before committing.
  2. Artifact persistence semantics (PR #177, "save production data with empty temp_documentation.json") — the fix implies a prior failure mode where an empty temp file could overwrite previously generated production documentation. Treat any docs-generation step that writes to a shared/production location as a destructive operation and gate it behind a spec diff.
  3. Versioning regression class (PR #189) — versioned docs have been fragile. If you run multi-version APIs, this is a must-test area, not a spot-check.
  4. PHPUnit 12 bump then revert (PRs #168/#172/#173) — dev-dependency churn only; no runtime impact. However, it signals that the test toolchain is in flux and that CI parity across the support matrix was only formalized in this release (PR #196, "run tests on all supported package versions"). Upgrade confidence is improving, not mature.
  5. Dependency surface — symfony/http-foundation 7.3.x, league/commonmark 2.8.x, and a dev dependency on phpoffice/phpspreadsheet (unusual for a Swagger package; likely export tooling). Confirm no transitive constraint conflicts with your Laravel/Symfony pins.
  6. Error page disclosure (PRs #164, #174, #185, #186, #191) — the package renders its own 500 page with stack trace handling (type key removed from trace, font/format changes). Verify this surface is disabled or sanitized outside local/staging.

Key questions:

  • Which Laravel and PHP versions are officially supported in 3.3 (PHP 8.4 is now tested; is Laravel 12 covered)?
  • Is the OpenAPI target 3.0 or 3.1, and is the new validator stricter or merely corrected? Are there documented migration notes?
  • Does generation run against a live app boot (route registration, container resolution) — and therefore require DB/config availability in CI?
  • How are generated artifacts versioned and diffed? Is there a deterministic-output guarantee suitable for PR review?
  • What is the intended production posture for the docs UI and the error page — enabled, IP-restricted, or debug-only?
  • Is there a supported path for hand-authored spec augmentation, or is generation fully authoritative?

Integration Approach

Stack fit: Laravel-first, Composer-distributed, no runtime service dependency. Best suited to teams whose API contracts are already expressed in Laravel constructs (routes, form requests, API Resources, policies) rather than in a separate contract-first workflow. Contract-first/design-first organizations will find the package's value diminished — it derives docs from code, which inverts that workflow.

Migration path: There is no prior assessment to reconcile, so treat 3.3 as the baseline. For a team adopting or upgrading:

  1. Install 3.3 in a non-production environment against a representative branch.
  2. Generate specs with the storage driver and versioning configuration matching your real topology (multi-version prefixes, local vs remote disk).
  3. Commit the generated artifact and diff it against any existing hand-maintained spec. The diff is your true migration cost — not the changelog.
  4. Run the new OpenAPI 3.0 validator in report-only mode first; promote to a CI gate once the baseline is clean.
  5. Only then wire generation into the pipeline and expose the UI in lower environments.

Compatibility: Pin explicitly. PHP 8.4 is exercised in CI (PR #175), and PHPUnit 12 support was reverted, so do not assume a PHPUnit 12 dev environment is validated. Verify symfony/http-foundation 7.3.x against your Laravel minor — Laravel 10/11 sit on Symfony 6.x/7.x lines respectively, so a hard 7.3 floor would constrain older Laravel majors. This is the single most likely install-time surprise.

Sequencing:

  • Phase 1 (week 1): install, generate, diff, validate. No CI gate.
  • Phase 2: fix validator findings; add generation to a non-blocking CI job that publishes the artifact as an artifact/diff comment.
  • Phase 3: make spec drift a blocking check; restrict docs UI and error page to non-prod.
  • Phase 4: adopt the new query-parameter expansion and invokable-controller support as the standard patterns, and codify controller conventions so generation stays accurate as the codebase grows.

Operational Impact

Maintenance: Active maintenance with visible velocity — ~30 merged PRs in this cycle, four first-time contributors (reduces single-maintainer bus factor), Dependabot enabled, and Laravel Pint adopted (PR #190) for style consistency. The trade-off is churn: PHPUnit 12 went in and out within the same release, and error-page formatting moved across four PRs. Expect frequent patch releases; budget a recurring, low-effort upgrade cadence rather than a set-and-forget dependency.

Support: Community-supported open source; no vendor SLA. For a TPM, that means the internal team owns the runbook: who regenerates docs, who triages validator failures, and what happens when an upgrade breaks generation. Assign a named owner before adoption.

Scaling: Documentation generation scales with route count, not traffic — cost is bounded and build-time. The scaling concern is organizational, not infrastructural: as the API surface grows across versions, generated output grows and spec diffs become noisy. Mitigate with per-version spec splits and deterministic output.

Failure modes to monitor:

  • Silent artifact clobbering — an empty/failed generation overwriting good documentation. The 3.3 fix (PR #177) addresses a known instance; treat generation as destructive and write to a new path, then promote.
  • Validator false negatives after PR #203 — spec validation failing on upgrade for pre-existing, real spec defects. Detected at CI time, mitigated by report-only rollout.
  • Versioned-route gaps — the class of bug fixed in PR #189; regression-test explicitly if you run /api/v1-style prefixes.
  • DI/container resolution failures — invokable controllers bound via contracts are now handled (PR #176), but generation that boots the app will fail on routes requiring DB or external config. Ensure generation runs with test-safe config.
  • Information disclosure — the package's own 500 error page renders stack trace detail. Confirm it is inert in production.
  • Dependency constraint conflicts — most likely at composer update time on older Laravel majors.

Ramp-up: Low for Laravel developers — no new mental model, conventions align with routes and controllers. Realistic ramp-up is under a day to first generated spec, and roughly one sprint to reach a trustworthy, CI-gated baseline given the spec-diff and validator remediation work. The non-obvious learning curve is in steering generation: adopting invokable controllers, consistent relation-loading patterns, and typed request/response definitions so the derived spec is accurate rather than merely present. That is a code-convention investment, and it is where most of the ongoing value (or debt) accrues.

Recommendation: Adopt 3.3 for teams on Laravel with code-derived API contracts. Treat the OpenAPI 3.0 validator change and the artifact-persistence fix as required regression-test targets, not incidental. Gate the docs UI and error page to non-production, and make spec generation deterministic and diffable before depending on it.

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.
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
equipc/laravel-email-database-log
adedsec/nova-translated-labels