This guide covers the fundamental ways to generate OpenAPI, Postman, and Insomnia documentation from your Laravel routes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/charlietyn/openapi-generator/llms.txt
Use this file to discover all available pages before exploring further.
Generate via Artisan
The simplest way to generate documentation is using theopenapi:generate Artisan command:
The
--all flag generates OpenAPI + Postman + Insomnia for all API types in a single command.Output Location
By default, files are written tostorage/app/public/openapi/. The generator creates these files:
openapi.json- OpenAPI 3.0.3 specificationpostman-all.json- Postman collection (when using--with-postmanor--all)insomnia-all.json- Insomnia workspace (when using--with-insomniaor--all)postman-env-*.json- Environment files for artisan, local, and production
Common CLI Options
Filter by API type
Generate documentation for specific API segments:
API types must be defined and enabled in
config/openapi.php under the api_types key.Expected CLI Output
When you run the command successfully, you’ll see output like this:Generate via HTTP Routes
Whenopenapi.routes.enabled is set to true in your configuration, the package automatically registers HTTP endpoints for on-demand documentation generation.
Available Endpoints
- OpenAPI
- Postman
- Insomnia
Query Parameters
Filter documentation using query parameters:Configuring HTTP Routes
Configure the HTTP endpoints inconfig/openapi.php:
Generate Programmatically
You can generate documentation from your own code using theOpenApiGenerator service:
Filtering Programmatically
Apply filters before generation:When to use programmatic generation
When to use programmatic generation
- Custom build pipelines: Generate docs during deployment
- On-demand generation: Create documentation when certain events occur
- Multi-tenant apps: Generate per-tenant documentation with different configurations
- Testing: Verify documentation structure in automated tests
Validating Output
After generation, validate your OpenAPI specification:Open in Swagger Editor
Visit editor.swagger.io and import your
openapi.json or openapi.yaml file.Import to Postman
- Open Postman
- Click File > Import
- Upload the generated
postman-all.json - Import each
postman-env-*.jsonenvironment file - Select an environment from the dropdown
Route Counting
The generator reports unique paths, not individual HTTP methods. For example:/api/users/{id} may have multiple methods (GET, PUT, DELETE), but counts as one path.
If you see
⚠️ No routes found matching the specified filters, check your API type configuration and ensure routes exist with the expected prefixes.Next Steps
Advanced Usage
Explore templates, caching, custom output paths, and programmatic filtering.
Common Scenarios
Real-world examples including multi-API generation and CI/CD workflows.