bchalier/laravel-openapi-autodoc
Laravel OpenAPI Autodoc
Generates OpenAPI v3 documentation from your Laravel routes, FormRequests and API Resources.
Compatible with Laravel 10–12 and PHP 8.1–8.4.
Install
-
Require the package in your app (Composer path repo supported):
-
Publish the config if you need to customize:
php artisan vendor:publish --tag=config --provider="Bchalier\LaravelOpenapiDoc\App\Providers\LoadingServiceProvider"
Usage
- Generate the JSON file:
php artisan documentation:generate
- Output file:
- Stored on the
publicdisk atstorage/app/public/documentation/openapi.json. - If you’ve run
php artisan storage:link, it’s available at/storage/documentation/openapi.json.
- Stored on the
How it works
- Parses route list and filters via
config/documentation.php. - Infers request schemas from FormRequest validation rules.
- Infers response schemas from return types:
JsonResource,ResourceCollection,JsonResponse. - Uses docblocks for operation summary/description and
@throwsto add error responses.
Notes
- Models instantiated for resources must use
Illuminate\Database\Eloquent\Factories\HasFactory. - When route names are missing, operationId falls back to
<method>_<uri>.
Related Packages
samody/laravel-smart-postman-generator
A smart Laravel-to-Postman collection generator focused on clean structure, smar...
2,028
1
wadakatu/laravel-spectrum
Zero-annotation OpenAPI/Swagger documentation generator for Laravel - automatic...
93
1
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.4.0 | ^8.1| | ^10.0| | MIT | |
| 0.3.0 | ^8.1| | ^10.0| | MIT | |
| 0.2.2 | ^8.1| | ^10.0| | MIT | |
| 0.2.1 | ^8.1| | ^10.0| | MIT | |
| 0.2.0 | ^8.1| | ^10.0| | MIT | |
| 0.1.7 | ^7.4| | ^8.0| | MIT | |
| 0.1.6 | ^7.4| | ^8.0 | MIT | |
| 0.1.5 | ^7.4| | ^8.0 | MIT | |
| 0.1.4 | ^7.4| | ^8.0 | MIT | |
| 0.1.3 | ^7.4| | ^8.0 | MIT | |
| 0.1.2 | ^7.4| | ^8.0 | MIT | |
| 0.1.1 | ^7.4| | ^8.0 | MIT | |
| 0.1.0 | ^7.4| | ^8.0 | MIT | |
| 0.0.6 | ^7.4| | ^8.0 | MIT | |
| 0.0.5 | ^7.4| | ^8.0 | MIT | |
| 0.0.4 | ^7.4 | ^8.0 | MIT | |
| 0.0.3 | ^7.4 | MIT | ||
| 0.0.2 | ^7.2 | 5.* | MIT | |
| 0.0.1 | ^7.2 | 5.* | MIT |