The Laravel OpenAPI Generator reads environment variables through configuration files. Set these in yourDocumentation 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.
.env file to customize behavior without modifying config files.
Core Variables
These variables control basic API information and metadata.Your application name. Used in:
openapi.info.title: API documentation title- Placeholder replacement:
${{projectName}}in URLs
Your application’s base URL. Used in:
openapi.environments.base.variables.base_url: Base environment URL- Server definitions for local development
Your API version string. Appears in:
openapi.info.version: OpenAPI specification version- API documentation header
Contact Information
These variables define support contact details in your API documentation.Support contact name displayed in API documentation.
Support contact email address.
URL to your support portal or documentation.
Cache Configuration
Control caching behavior for generated OpenAPI specifications.Enable or disable caching of generated specifications.
Disable caching during development for immediate reflection of changes:
Cache time-to-live in seconds (default: 1 hour).
Route Configuration
Control HTTP endpoints that serve OpenAPI documentation.Enable or disable HTTP documentation endpoints.
URL prefix for documentation routes.Results in routes like:
/api-docs/openapi.json/api-docs/postman/collection.json
Comma-separated list of middleware to apply to documentation routes.
Empty string means no middleware. Add
auth to require authentication for viewing docs.Template System
Control the JSON template engine for advanced documentation customization.Enable or disable the template system.
Enable debug output for template rendering.
Useful for troubleshooting template rendering issues during development.
Validate template output against OpenAPI schema.
Cache rendered templates for better performance.
Template cache time-to-live in seconds.
Test Generation
Control test script generation for Postman and Insomnia.Enable verbose logging for test generation.
Helpful for debugging test script generation issues.
Complete Example: .env File
Here’s a complete example showing all OpenAPI Generator environment variables:Runtime vs Cached Configuration
Safe with config:cache
These are read once during config caching:- All
openapi.phpconfig values - All template system settings
- Cache and route configurations
Requires runtime access
These may need runtimeenv() access:
- Placeholder replacement in URLs (
${{projectName}}) - Dynamic environment variable generation
config/openapi.php
Quick Reference
| Variable | Config Key | Default | Purpose |
|---|---|---|---|
APP_NAME | openapi.info.title | 'Laravel' | API title |
APP_URL | openapi.environments.base.variables.base_url | 'http://localhost' | Base URL |
API_VERSION | openapi.info.version | '1.0.0' | API version |
API_CONTACT_NAME | openapi.info.contact.name | 'API Support' | Contact name |
API_CONTACT_EMAIL | openapi.info.contact.email | 'support@example.com' | Contact email |
API_CONTACT_URL | openapi.info.contact.url | 'https://example.com/support' | Contact URL |
OPENAPI_CACHE_ENABLED | openapi.cache.enabled | true | Enable caching |
OPENAPI_CACHE_TTL | openapi.cache.ttl | 3600 | Cache TTL (seconds) |
OPENAPI_ROUTES_ENABLED | openapi.routes.enabled | true | Enable routes |
OPENAPI_ROUTES_PREFIX | openapi.routes.prefix | 'documentation' | Route prefix |
OPENAPI_ROUTES_MIDDLEWARE | openapi.routes.middleware | '' | Route middleware |
OPENAPI_TEMPLATES_ENABLED | openapi-templates.enabled | true | Enable templates |
OPENAPI_TEMPLATES_DEBUG | openapi-templates.rendering.debug | false | Debug templates |
OPENAPI_TEMPLATES_VALIDATE | openapi-templates.rendering.validate_output | true | Validate output |
OPENAPI_TEMPLATES_CACHE | openapi-templates.rendering.cache_enabled | true | Cache templates |
OPENAPI_TEMPLATE_CACHE_TTL | openapi-templates.rendering.cache_ttl | 3600 | Template cache TTL |
OPENAPI_TESTS_VERBOSE | openapi-tests.verbose_logging | false | Verbose test logs |