API Type Filtering
API types allow you to segment your routes into logical groups (e.g., admin, mobile, public). Each API type can have its own prefix, folder structure, and enable/disable toggle.Configuring API Types
Define API types inconfig/openapi.php:
Routes are matched by the
prefix value. A route like /admin/users matches the admin API type.Filtering at Runtime
- CLI
- HTTP
- Programmatic
openapi-admin.jsonpostman-mobile.json
Legacy API Type Aliases
Environment Management
Environments define base URLs, authentication tokens, and other variables for different deployment stages (local, staging, production).Configuring Environments
Define environments inconfig/openapi.php:
Selecting Environments
1
Via CLI
artisan:2
Via HTTP
3
Environment Files
The generator creates separate environment files for Postman:
postman-env-artisan.jsonpostman-env-local.jsonpostman-env-production.json
Caching
The generator caches OpenAPI specifications to improve performance for large applications.Cache Configuration
Disabling Cache
Cache Keys
The generator builds cache keys from:- API type filters
- Environment name
- Generation type (openapi, postman, insomnia)
Custom Output Paths
Override the default output directory:- Single File
- Directory Override
The generator automatically creates parent directories if they don’t exist.
Template-Driven Documentation
The template system allows you to standardize descriptions, summaries, and request/response documentation across CRUD operations.Enabling Templates
Publish and enable template processing:config/openapi-templates.php:
Template Structure
Generic templates define reusable documentation for standard CRUD actions:Example: list.json
Example: list.json
Example: show.json
Example: show.json
Custom Endpoint Documentation
For non-CRUD endpoints, define custom documentation inconfig/openapi-docs.php:
Template Processing Flow
1
Route Introspection
The generator extracts route metadata: path, methods, parameters, FormRequests.
2
Template Selection
- Check for custom endpoint documentation by route name
- If not found, match CRUD action (list, show, create, update, delete)
- Load corresponding generic template
3
Placeholder Replacement
Replace placeholders like
{{entity_singular}} and {{entity_plural}} with actual values.4
Merge with Metadata
Combine template content with extracted FormRequest validation rules and model properties.
Excluding Routes
Prevent specific routes from appearing in documentation:Programmatic Generation Advanced
For complex use cases, you can directly access generation services:Service Responsibilities
Service Responsibilities
OpenApiServices
- Route introspection and filtering
- Caching
- OpenAPI specification assembly
- Converts OpenAPI spec to Postman Collection v2.1 format
- Embeds environment variables
- Converts OpenAPI spec to Insomnia v4 format
- Creates workspace with spec, collection, and test tabs
- Merges base + tracking + sub-environment variables
- Generates environment files for Postman and Insomnia
Next Steps
Common Scenarios
Real-world examples including team workflows and CI/CD integration.
Edge Cases
Handling config caching, concurrent generation, and multi-tenant deployments.