Skip to content
Nav

OpenAPI Docs Generator

composer require langsys/openapi-docs-generator
Packagist version Monthly downloads License PHP 8.1+ Laravel 10 / 11

Generate OpenAPI 3.x documentation directly from Spatie Laravel Data DTOs. No intermediate annotation files, no UI bundling — just your DTOs reflected into api-docs.json (and optionally YAML), merged with any hand-written controller annotations.

This is the same generator that produces the spec behind docs.langsys.dev/api. langsys/swagger-auto-generator is the abandoned predecessor; use this package.

php artisan openapi:generate
|
+-- Scan controller annotations (zircote/swagger-php)
+-- (Filtered sets) Select operations by their route's middleware
+-- Reflect on Spatie Data DTOs → build OpenAPI Schema objects in memory
+-- Discover error classes → error schemas and reusable responses
+-- Merge DTO and error schemas into the OpenAPI model
+-- Attach error responses to operations (#[Throws], implied_errors, rules)
+-- Prune components/tags nothing references
+-- Inject security definitions from config
+-- Write api-docs.json / api-docs.yaml

DTO-generated schemas are additive: if a schema with the same name already exists from your annotations, the annotation version wins.

Feedback