wadakatu / laravel-spectrum
Zero-annotation OpenAPI/Swagger documentation generator for Laravel - automatic API docs from your existing code
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 5
pkg:composer/wadakatu/laravel-spectrum
Requires
- php: ^8.2
- illuminate/console: ^11.0|^12.0
- illuminate/routing: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
- nikic/php-parser: ^5.5
- spatie/fork: ^1.2
- symfony/finder: ^6.0|^7.0
- workerman/workerman: ^5.1
Requires (Dev)
- devizzent/cebe-php-openapi: ^1.1
- fakerphp/faker: ^1.23
- infection/infection: *
- laravel/pint: ^1.23
- orchestra/testbench: ^9.0|^10.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0|^11.0|^12.0
- spatie/phpunit-snapshot-assertions: ^5.2
- dev-main
- v1.0.1
- v1.0.0
- v0.2.2-beta
- v0.2.1-beta
- v0.2.0-beta
- v0.1.0-beta
- v0.0.18-alpha
- v0.0.17-alpha
- v0.0.16-alpha
- v0.0.15-alpha
- v0.0.14-alpha
- v0.0.13-alpha
- v0.0.12-alpha
- v0.0.11-alpha
- v0.0.10-alpha
- v0.0.9-alpha
- v0.0.8-alpha
- v0.0.7-alpha
- v0.0.6-alpha
- v0.0.5-alpha
- v0.0.4-alpha
- v0.0.3-alpha
- v0.0.2-alpha
- v0.0.1-alpha
- dev-dependabot/npm_and_yarn/docs/lodash-4.17.23
- dev-claude/replace-mixed-with-dto-aGqvu
- dev-claude/improve-issue-content-MnTst
- dev-docs/upgrade-guide
- dev-refactor/reduce-phpstan-baseline
- dev-refactor/apply-validation-rule-collection
- dev-refactor/resource-detection-result-dto
- dev-refactor/fractal-auth-dto
- dev-gitlyte/update-site-2025-12-25T03-56-40
- dev-gitlyte/update-site-2025-12-25T03-01-51
- dev-gitlyte/update-site-2025-12-25T02-47-04
- dev-gitlyte/update-site-2025-12-25T02-23-25
- dev-gitlyte/update-site-2025-12-24T03-38-02
- dev-feature/beta_test
- dev-release-please--branches--main
- dev-update-banner-1752163014
- dev-fix/route-reload-error-handling
- dev-feat/route-reload-implementation
- dev-fix/route-cache-refresh-issue
This package is auto-updated.
Last update: 2026-01-23 20:57:59 UTC
README
Zero-annotation OpenAPI documentation generator for Laravel
Generate complete API docs from your existing code in seconds. No annotations required.
Documentation • Quick Start • Compare
The Problem
// ❌ Traditional approach: Annotations everywhere /** * @OA\Post( * path="/api/users", * @OA\RequestBody( * @OA\JsonContent( * @OA\Property(property="name", type="string"), * @OA\Property(property="email", type="string", format="email"), * // ... 50 more lines of annotations * ) * ), * @OA\Response(response="200", description="Success") * ) */ public function store(StoreUserRequest $request) { ... }
With Laravel Spectrum: Zero annotations needed. Your existing FormRequest and Resource classes are your documentation.
Quick Start (30 seconds)
# Install composer require wadakatu/laravel-spectrum --dev # Generate OpenAPI documentation php artisan spectrum:generate # View in browser (HTML with Swagger UI) php artisan spectrum:generate --format=html # Open: storage/app/spectrum/openapi.html
That's it. Full OpenAPI 3.1 documentation generated from your existing code.
What Gets Analyzed Automatically
| Your Code | Generated Documentation |
|---|---|
FormRequest::rules() |
Request body schemas with validation |
$request->validate([...]) |
Inline validation rules |
API Resources |
Response schemas |
Auth middleware (auth:sanctum) |
Security schemes |
Route parameters ({user}) |
Path parameters with types |
@deprecated PHPDoc |
Deprecated operation flags |
Key Features
Real-time Documentation
php artisan spectrum:watch
# Browser auto-refreshes when you change code
Built-in Mock Server
php artisan spectrum:mock
# Frontend team can develop without waiting for backend
Export to API Clients
php artisan spectrum:export postman # Postman collection php artisan spectrum:export insomnia # Insomnia workspace
High Performance
- Parallel processing for large codebases
- Incremental generation (only changed files)
- Smart caching
Why Laravel Spectrum?
| Laravel Spectrum | Swagger-PHP | Scribe | |
|---|---|---|---|
| Zero annotations | ✅ | ❌ | Partial |
| Setup time | 30 sec | Hours | ~30 min |
| FormRequest detection | ✅ | ❌ | ✅ |
| Mock server | ✅ | ❌ | ❌ |
| Live reload | ✅ | ❌ | ❌ |
| Postman/Insomnia export | ✅ | ❌ | ✅ |
| OpenAPI 3.1 | ✅ | ✅ | ❌ |
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
Documentation
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
Laravel Spectrum is open-source software licensed under the MIT license.
Made with ❤️ by wadakatu