spatie/laravel-openapi-cli
Generate Laravel Artisan commands from any OpenAPI spec. Each endpoint becomes a CLI command with typed options for path/query params and request bodies. Configure base URL, auth, caching, output formats, redirects, and custom error handling—great with Laravel Zero.
php artisan api:call /users).spatie/laravel-openapi-cli) with zero config for basic usage. Requires:
config/openapi.php or custom path.spatie/laravel-package-tools (for package bootstrapping) and symfony/console.zircote/swagger-php (lightweight, no heavyweight tools like Swagger UI).$refs).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Spec Parsing Errors | High | Validate OpenAPI specs with spectral or swagger-cli pre-integration. |
| Command Bloat | Medium | Use --filter CLI flags to generate only needed endpoints. |
| AI Agent Misuse | Medium | Document rate-limiting and auth requirements in generated commands. |
| Laravel Version Lock | Low | Package supports LTS Laravel versions; monitor deprecations. |
| Custom Logic Gaps | Low | Extend via OpenApiCommand events or override default behavior. |
$ref usage)?curl/Postman with Laravel-native commands (e.g., php artisan api:fetch /orders --limit=10).swagger-php or openapi-generator in the pipeline.spatie/laravel-openapi-cli.composer require spatie/laravel-openapi-cli.config/openapi.php to point to spec files.php artisan openapi:generate (dry run).symfony/process wrappers.| Component | Compatibility Notes |
|---|---|
| Laravel | Tested on 10.x; may need tweaks for 9.x (PHP 8.0). |
| OpenAPI Specs | Supports OAS 2.0/3.0/3.1; complex specs (e.g., dynamic $refs) may need tuning. |
| AI Agents | Works with tools like LangChain or Hugging Face via CLI execution. |
| CI/CD | Can be gated in PRs to validate OpenAPI specs before merging. |
| Monorepos | Supports package-level specs (e.g., vendor/package/openapi.yaml). |
config/openapi.php.php artisan openapi:generate.OpenApiCommand events.--help output).spatie/laravel-openapi-cli is abandoned, fork or rewrite may be needed.InvalidOpenApiSpecException: Spec validation fails (fix with spectral lint).CommandNotFoundException: Spec path misconfigured in config/openapi.php.php artisan openapi:generate --verbose for detailed parsing logs.php artisan openapi:validate to check spec health.--help and package docs.$refs (mitigate with --filter).curl scripts for common API tasks.How can I help you explore Laravel packages today?