This guide will walk you through generating your first OpenAPI specification, Postman collection, and Insomnia workspace from your Laravel application.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.
Prerequisites
Before you begin, ensure you have:- Laravel 10.x, 11.x, or 12.x installed
- PHP 8.1 or higher
- Composer 2.x
If you haven’t installed the package yet, follow the Installation Guide first.
Step 1: Install the Package
Publish Configuration (Recommended)
config/openapi.php where you can customize your API documentation settings.Step 2: Generate Your First Spec
- OpenAPI JSON
- OpenAPI YAML
- All Formats
Generate an OpenAPI 3.0.3 JSON specification:Output:
storage/app/public/openapi/openapi.jsonThe default output path is
storage/app/public/openapi/. You can change this in config/openapi.php under output_path.Step 3: Configure API Types
Most Laravel applications have multiple API surfaces (admin panel, mobile API, public site). Configure these inconfig/openapi.php:
config/openapi.php
Step 4: Access via HTTP (Optional)
Enable HTTP routes inconfig/openapi.php:
Filter by API Type
Add query parameters to filter by API type:Complete Example: User Management API
Let’s document a complete user management endpoint.1. Create the Route
routes/api.php
2. Create FormRequest Validation
app/Http/Requests/StoreUserRequest.php
3. Controller
app/Http/Controllers/UserController.php
4. Generate Documentation
5. Generated OpenAPI Schema
The package automatically generates:Generated openapi.json (excerpt)
Import Into Tools
Postman
- Open Postman
- Click Import in the top left
- Select Upload Files
- Import
postman-all.json(orpostman-admin.json) - Import environment files (
postman-env-*.json) - Select environment from the dropdown
Insomnia
- Open Insomnia
- Click Application → Import/Export → Import Data → From File
- Select
insomnia-all.json - The workspace includes:
- All requests organized by API type
- Pre-configured environments (artisan, local, production)
- Automated tests
- Minimal API spec tab
Swagger UI
- Visit Swagger Editor
- Click File → Import file
- Select
openapi.jsonoropenapi.yaml
Troubleshooting
No routes found
No routes found
Problem: Running
php artisan openapi:generate shows “No routes found”Solution:- Check
exclude_routesinconfig/openapi.php- you might be excluding too many routes - Verify your routes are registered in
routes/api.php - Run
php artisan route:listto see all available routes
Invalid api_type error
Invalid api_type error
Problem: Error “Unknown or disabled API types: xyz”Solution:
- Check
config/openapi.php→api_types - Ensure the API type exists and
enabledistrue - Clear config cache:
php artisan config:clear
Placeholders not updating
Placeholders not updating
Problem:
${{projectName}} still appears in generated docsSolution:- Clear config cache:
php artisan config:clear - Set values explicitly in
config/openapi.phpinstead of usingenv() - Restart Laravel if using
php artisan serve
Next Steps
Core Concepts
Learn about API types, environments, and how the package works
Configuration
Explore all configuration options and customization
Usage Guides
Advanced generation techniques and workflows
API Reference
Complete API documentation and command reference