The Laravel OpenAPI Generator uses multiple configuration files to control every aspect of documentation generation. This page documents all available options with their default values.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.
Main Configuration: openapi.php
Publish with:info
Defines the OpenAPI metadata displayed in your documentation.The title of your API documentation. Automatically uses your application name from
APP_NAME.A description of your API that appears at the top of the documentation.
The version of your API. Can be controlled via the
API_VERSION environment variable.Contact information for API support.
name: Contact name (default:env('API_CONTACT_NAME', 'API Support'))email: Contact email (default:env('API_CONTACT_EMAIL', 'support@example.com'))url: Support URL (default:env('API_CONTACT_URL', 'https://example.com/support'))
License information for your API.
name: License name (default:'MIT')url: License URL (default:'https://opensource.org/licenses/MIT')
servers
Defines the available API servers for different environments.Array of server definitions. Each server has:
url: The server URLdescription: Human-readable description
The
${{projectName}} placeholder is automatically replaced with your application name during generation.security
Defines authentication schemes available in your API.Map of security scheme names to their definitions. Each scheme supports OpenAPI 3.0 security scheme properties.
BearerAuth (JWT)
BearerAuth (JWT)
Default JWT Bearer token authentication scheme.
ApiKeyAuth
ApiKeyAuth
API Key authentication via custom header.
You can add custom security schemes here. They will be automatically included in your OpenAPI spec and Postman/Insomnia collections.
environments
Defines hierarchical environments with variable inheritance for Postman and Insomnia collections.Map of environment names to their configurations. Supports parent-child inheritance via the
parent key.base environment (required)
base environment (required)
The base environment that all other environments inherit from.
Sub-environments
Sub-environments
Child environments inherit from
base and can override specific variables.Tracking Variables are used to chain CRUD operations. After creating a user, the ID is stored in
last_user_id and can be used in subsequent requests like: /users/{{last_user_id}}api_types
Configure different API types with their own route prefixes, files, and middleware.Map of API type keys to their configurations. Each API type can have its own route file, prefix, middleware, and documentation folder.
prefix: Route prefix for this API typefile: Route file name inroutes/directorydescription: Description shown in documentationfolder_name: Folder name in Postman/Insomnia collectionsicon: Emoji icon for visual identificationmiddleware: Middleware applied to these routesenabled: Toggle to enable/disable this API type
modules_path
Base path where your modules are located (for modular architectures like Nwidart Modules).The absolute path to your modules directory.
exclude_modules
Exclude entire modules from documentation generation.Array of module names to exclude from scanning.
exclude_module_routes
Exclude specific route patterns within modules.Array of route patterns to exclude from specific modules.
cache
Configure caching for generated OpenAPI documents.Enable or disable caching of generated specifications.
Cache time-to-live in seconds. Default is 1 hour (3600 seconds).
Prefix for cache keys to avoid collisions.
output_path
Base directory for generated OpenAPI specs and collections.The absolute path where generated files will be saved.
Generated files will be organized in subdirectories:
openapi/: OpenAPI JSON specspostman/: Postman collectionsinsomnia/: Insomnia collections
paths
Define paths to scan for models and request classes.Array of namespaces where models are located. Use
{module} placeholder for module scanning.Array of namespaces where FormRequest classes are located.
The
{module} placeholder is replaced with each module name during scanning, allowing the generator to find resources across all modules.exclude_routes
Exclude certain routes from documentation.Array of URI patterns to exclude. Supports wildcards (
*).middleware_security_map
Map Laravel middleware to OpenAPI security requirements.Map of middleware names to security scheme names defined in the
security configuration.When a route uses mapped middleware, the corresponding security requirements are automatically added to the OpenAPI operation.
response_examples
Define default response examples for common HTTP status codes.Map of status codes to their response definitions following OpenAPI 3.0 response object schema.
200 - Success
200 - Success
201 - Created
201 - Created
401 - Unauthenticated
401 - Unauthenticated
403 - Forbidden
403 - Forbidden
404 - Not Found
404 - Not Found
422 - Validation Error
422 - Validation Error
500 - Server Error
500 - Server Error
routes
Configure HTTP routes for documentation access.Enable or disable HTTP documentation endpoints.
URL prefix for documentation routes.
Middleware to apply to documentation routes. Reads from comma-separated env variable.
Set
OPENAPI_ROUTES_MIDDLEWARE="auth,admin" in your .env to protect documentation routes.Additional Configuration Files
The package includes three additional configuration files for advanced customization:openapi-docs.php
Controls CRUD templates, entity metadata, and custom endpoints. Key sections:crud_templates: Summary/description/response templates for CRUD actionsentities: Optional metadata for entities (singular/plural, model, description)custom_endpoints: Custom documentation for non-CRUD endpointsauto_detect: Enables automatic field/relationship extractionfield_descriptions: Override field descriptionsfield_examples: Override field examples
openapi-templates.php
Template engine controls for JSON templates underresources/openapi/templates/.
Key sections:
enabled: Toggle template systempaths: Paths for generic/custom templatesgeneric_templates: Action-to-template mapquery_builder: Controls query builder documentationauto_detect: Model metadata extraction togglesrendering: Debug/validate/cache rendering settingsexamples: Example generation settingsperformance: Limits and caching for metadata extraction
openapi-tests.php
Test template definitions for Postman and Insomnia. Key sections:templates: Test checks for CRUD actionssnippets: Actual test scripts for Postman/Insomniacustom_tests: Overrides for endpoint-specific test scripts
These configuration files are published together with
openapi.php when you run: