smoggert / swagger-generator
Generates swagger documentation based on your laravel API.
Installs: 3 400
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 2
Requires
- php: ^8.1
- laravel/framework: ^10.0|^11.0
- dev-master
- v3.3.1
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.1
- v3.1.0
- v3.0.0
- v2.0.0
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0
- dev-analysis-O37O6k
- dev-improvement/response_parser
- dev-analysis-DynlkJ
- dev-analysis-vZD5xr
- dev-improvement/move_json_parsing
- dev-analysis-kYby34
- dev-analysis-BoaBrW
- dev-improvement/json_parser
- dev-analysis-VB32EZ
- dev-improvement/parsers
- dev-analysis-N4v21p
- dev-analysis-yrQpkL
- dev-analysis-YObRGy
- dev-analysis-W6M2aO
- dev-analysis-djbnxp
- dev-Smoggert-L10
- dev-Smoggert-fix-missing-directories
- dev-analysis-e0pQkK
- dev-analysis-rrgOd3
- dev-Smoggert-upgrade-to-laravel-9
- dev-improvement/jsonbody_enums
- dev-analysis-kY0e2G
- dev-analysis-2Qw9lg
- dev-enum_array_choices
- dev-dev/enum_array_choices
- dev-Smoggert-adding-controller-methods
- dev-analysis-x0PWaB
- dev-analysis-yvwE0N
- dev-analysis-1bjd0P
- dev-analysis-WNnwny
This package is auto-updated.
Last update: 2025-04-23 15:02:12 UTC
README
Swagger-generator is a package for Laravel that produces open-api 3.1.0 spec documentation based on Form Requests and Json Resources.
I'm mostly writing this so I can stop using 50000 lines of phpdoc code to document our api.
Installation
You can place this in require-dev and just run the command during deploy/dev. No need to have this package on production.
composer require smoggert/swagger-generator
!! Prerequisits !!
The swagger generator looks through your code based on its controller function's return values and typed arguments. If you do no supply any it won't find any. The package does not parse PhPDocs. The entire reason for this package is to avoid PhpDocs.
A controller action should have typed requests, a typed resource as return value.. This package relies on this strict "linting" to get it's results. If you write horrible controllers that cannot be parsed I suggest using this package instead:
https://github.com/DarkaOnLine/L5-Swagger
Configuration
The script currently works on an include route X basis. If you want to specify which routes you'd like to include, (among other things), I highly recommend publishing the configuration file and adjusting it.
php artisan vendor:publish --tag=config
Usage
Available in json-format.
php artisan swagger:generate
Contributing
Open for feature requests if accompanied with some effort from the requester.