Download the PHP package danialzash/laravel-openapi-generator without Composer
On this page you can find all versions of the php package danialzash/laravel-openapi-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danialzash/laravel-openapi-generator
More information about danialzash/laravel-openapi-generator
Files in danialzash/laravel-openapi-generator
Package laravel-openapi-generator
Short Description Automatically generate OpenAPI 3.1 specifications from Laravel routes, requests, and responses
License MIT
Homepage https://github.com/danialzash/laravel-openapi-generator
Informations about the package laravel-openapi-generator
Laravel OpenAPI Generator
A powerful Laravel package that automatically generates OpenAPI 3.1 specifications from your Laravel application by analyzing routes, form requests, controllers, and JSON resources.
Features
- Automatic Route Analysis: Scans all Laravel routes and extracts parameters, middleware, and controller information
- Request Validation Mapping: Converts Laravel validation rules to OpenAPI schema definitions
- Response Schema Detection: Analyzes JsonResource classes to generate response schemas
- Security Scheme Detection: Maps authentication middleware to OpenAPI security schemes
- Database-Driven Metadata: Store custom descriptions, examples, and tags in the database
- Incremental Updates: Track route changes and update documentation incrementally
Installation
1. Add the package to your composer.json
2. Run composer update
3. Publish the configuration (optional)
4. Run migrations
Usage
Scan Routes
Scan your application routes and populate the metadata database:
Generate OpenAPI Specification
Generate the OpenAPI specification file:
Sync Metadata
Synchronize database metadata with current codebase:
Configuration
The configuration file allows you to customize:
API Info
Route Filters
Security Schemes
Response Macros
Map custom response helpers to HTTP status codes:
Adding Custom Metadata
Via Database
After scanning routes, you can update metadata directly in the database:
Via Custom Schemas
Add custom schema definitions:
Validation Rule Mapping
The package automatically maps Laravel validation rules to OpenAPI types:
| Laravel Rule | OpenAPI Type |
|---|---|
string |
type: string |
integer |
type: integer |
numeric |
type: number |
boolean |
type: boolean |
array |
type: array |
email |
type: string, format: email |
url |
type: string, format: uri |
uuid |
type: string, format: uuid |
date |
type: string, format: date |
in:a,b,c |
enum: [a, b, c] |
min:N |
minimum: N or minLength: N |
max:N |
maximum: N or maxLength: N |
required |
Added to required array |
nullable |
nullable: true |
Programmatic Usage
License
MIT License
All versions of laravel-openapi-generator with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/routing Version ^10.0|^11.0
illuminate/console Version ^10.0|^11.0
symfony/yaml Version ^6.0|^7.0
nikic/php-parser Version ^5.0