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

mtrajano/laravel-swagger

Generate Swagger/OpenAPI documentation for Laravel APIs directly from your routes and controller annotations. mtrajano/laravel-swagger scans your app to produce interactive API docs, reducing manual spec maintenance and keeping endpoints in sync.

Deep Wiki
Context7

Laravel Swagger generates OpenAPI/Swagger documentation for Laravel APIs from Swagger-PHP annotations, eliminating hand-written specs. Run an Artisan command to scan configured paths and produce a JSON spec that stays close to your code and is ready for Swagger UI or other API tooling.

  • Artisan command for generating API docs
  • Annotation-driven OpenAPI schemas
  • Publishable config for source paths and output location
  • Configurable API metadata (title, version, description)
  • Simple Laravel integration
Frequently asked questions about Laravel Swagger
What is mtrajano/laravel-swagger used for?
It is a Laravel package that auto-generates Swagger/OpenAPI documentation for your API based on routes, annotations, and simple conventions. It also serves Swagger UI so developers can browse endpoints and test requests. It is best treated as a build-time documentation accelerator rather than a runtime API dependency.
How do I install mtrajano/laravel-swagger in a Laravel application?
Install it with Composer using the package name mtrajano/laravel-swagger, then publish any provided configuration if needed. Laravel auto-discovery may register the service provider, but you should verify this against your exact framework version. Because the last release was in 2020, test installation in an isolated branch before adding it to a shared application.
Does laravel-swagger support Laravel 9, 10, or 11 and PHP 8.1+?
Compatibility with modern Laravel and PHP versions is not guaranteed because the last package release was 2020-11-22. You should expect that Laravel 9, 10, or 11 and PHP 8.1+ may require patching, dependency overrides, or an internal fork. Validate exact Laravel, PHP, and Composer constraints in a spike before adoption.
Does mtrajano/laravel-swagger generate Swagger 2.0 or OpenAPI 3.x?
The package is named around Swagger, but you must verify the exact output specification version for your target consumers. Swagger 2.0 versus OpenAPI 3.x compatibility is a known risk when generated specs feed gateways, portals, or client generators. Validate the emitted document with OpenAPI tooling before treating it as a usable contract.
How does laravel-swagger discover routes and generate documentation?
It introspects Laravel routes and controllers and applies simple assumptions and annotations to produce documentation. Coverage may be incomplete for complex route definitions, middleware, form requests, or API resources. Review generated output against your actual route table and add annotations where discovery falls short.
Can laravel-swagger document authentication, middleware, and form requests correctly?
Authentication and middleware handling can have edge cases, so do not assume generated security definitions are complete. Check protected endpoints, token or session auth, and middleware groups in the generated spec. Form request validation and API resource transformations may also need manual annotations or review.
Should I expose laravel-swagger documentation in production?
Avoid exposing generated documentation publicly unless you have reviewed it for internal endpoints and sensitive details. A safer pattern is to generate the spec in CI and publish it as a controlled build artifact or behind authenticated access. Keep Swagger UI isolated from production routes when possible.
How do I use laravel-swagger in a CI pipeline?
Run the documentation generation command as a CI job and store the generated Swagger/OpenAPI file as an artifact. Validate the output with OpenAPI tooling and diff route coverage so missing or stale endpoints are visible. Do not make it a release blocker until you have a proven fallback and ownership model.
What are alternatives to mtrajano/laravel-swagger for Laravel API documentation?
Alternatives include OpenAPI-first workflows, annotation-based documentation packages, and other Laravel documentation generators such as Scribe or Scramble. The right choice depends on whether you need Swagger 2.0, OpenAPI 3.x, contract-first governance, or quick convention-based output. If you already have a schema registry or gateway contract process, prefer an OpenAPI-first tool.
Is mtrajano/laravel-swagger maintained and safe to adopt?
The repository provenance is listed as unknown, and the last release was 2020-11-22, so license, security posture, and maintainer activity need validation. Expect internal ownership for dependency upgrades, Laravel compatibility patches, and generator fixes. Adopt it only as an accelerator with a fork strategy and a clear replacement path if it is abandoned.
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
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core