riconijeboer/laravel-to-swagger
laravel-to-swagger generates Swagger/OpenAPI documentation for Laravel applications, turning routes and controllers into browsable API docs so your specification stays aligned with the code you ship.
composer require riconijeboer/laravel-to-swagger. Because the package is archived (last release Feb 2022), pin your Laravel/PHP versions first — it predates Laravel 10/11, so expect dependency conflicts on modern apps. Safest on Laravel 8 or 9.php artisan vendor:publish --tag=swagger-config, or check the package README for the exact tag) and open config/swagger.php first. That file is the source of truth for the generated OpenAPI document — info block, servers, tags, security schemes, and the paths/components arrays.GET /api/ping with a 200 response schema. Run the package's generate command (typically php artisan swagger:generate or similar) and confirm a valid openapi: 3.0.x JSON/YAML lands in the configured output path.l5-swagger or any static Swagger UI if you need a browser view. That pairing is the first real use case: one config file → one generated JSON → one browsable doc.src/ for the generator class and any Swagger facade early. With a small, archived package you'll rely on reading source rather than docs.config/swagger.php as the API contract. Because the spec is authored in PHP arrays rather than annotations, it reviews well in PRs and diffs cleanly. Keep route definitions in Laravel and the OpenAPI paths side-by-side in the same PR.swagger/auth.php, swagger/users.php) and merge them in a service provider or custom command before generation. The package's config array is just PHP — array_merge_recursive or data_get/Arr::set works fine.components.schemas.User, components.responses.NotFound, components.securitySchemes.bearerAuth once and $ref them. This keeps the generated file small and makes codegen (openapi-generator, orval) usable downstream./users/{user} not /users/{id}) so generated clients and Laravel's route model binding agree. This is the most common source of drift between the spec and the app.swagger-cli validate or Spectral. A malformed $ref or a missing responses block silently produces a file that breaks client generators.dedoc/scramble or knuckleswtf/scribe. With 22 stars, community answers are scarce — you are the maintainer.type: ["string","null"]) into the config; they'll be ignored or rejected.config:cache will freeze your spec inputs. If the config pulls from env() or runtime values, resolve them at generation time, not in the config file, or your cached config will bake stale values into the spec. Prefer generating from a dedicated command or service that reads fresh data.Kernel::$commands rather than auto-discovery. If php artisan list doesn't show it, check src/Console and register manually./users/{id} vs /users/me). Order matters in some tooling; document the more specific one and rely on Laravel's route ordering to match.nullable: true and omit the property from required if it's optional. Forgetting one produces confusing generated clients.npx @apidevtools/swagger-cli validate storage/app/swagger.json catches 90% of "the UI shows nothing" issues. Swagger UI failing to render is almost always a $ref typo or a mis-indented array in the config.How can I help you explore Laravel packages today?