wadakatu / laravel-spectrum
Zero-annotation OpenAPI/Swagger documentation generator for Laravel - automatic API docs from your existing code
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 4
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-feature/issue-297-json-schema-2020-12
- dev-feature/issue-301-non-json-response-detection
- dev-feature/issue-316-custom-rule-analysis
- dev-chore/add-renovate
- dev-docs/openapi-extensions
- dev-feature/fractal-transformer-demo-support
- dev-docs/configure-algolia-docsearch
- dev-docs/seo-improvements
- dev-fix/switch-to-shields-io-badges
- dev-docs/update-readme-for-v1
- dev-docs/203-v1-release-notes
- dev-docs/add-documentation-rules
- dev-refactor/consolidate-docs
- dev-fix/293-remove-lumen-references
- dev-feature/361-support-infrastructure-types
- dev-feature/360-analyzer-types
- dev-fix/378-type-accuracy
- dev-feature/359-ast-visitor-types
- dev-feature/358-generator-types
- dev-feature/356-formatters-types
- dev-feature/357-mockserver-types
- dev-feature/367-mock-response-type
- dev-feature/366-export-types
- dev-claude/replace-mixed-with-dto-aGqvu
- dev-feature/365-route-definition-type
- dev-feature/364-openapi-schema-type
- dev-claude/improve-issue-content-MnTst
- dev-feature/363-openapi-operation-type
- dev-feature/362-openapi-spec-dto
- dev-refactor/201-reduce-phpstan-baseline
- dev-feature/292-integrate-validate-references
- dev-feature/309-request-header-detection
- dev-fix/310-delete-request-body
- dev-feature/304-route-where-constraints
- dev-feature/302-deprecated-annotation
- dev-fix/303-required-if-validation
- dev-fix/307-get-query-parameters
- dev-fix/308-when-counted-type
- dev-fix/313-password-rule-object
- dev-fix/317-file-rule-object
- dev-fix/323-required-array-keys
- dev-fix/312-file-upload-detection
- dev-dependabot/npm_and_yarn/docs-site/qs-6.14.1
- dev-fix/325-confirmed-field
- dev-fix/311-rule-in-enum
- dev-fix/305-additional-formats
- dev-fix/315-array-items-constraints
- dev-fix/314-numeric-constraints
- dev-fix/318-string-length-constraints
- dev-fix/319-regex-pattern
- dev-fix/324-exclude-rules
- dev-fix/322-date-format
- dev-fix/320-decimal-example
- dev-fix/321-accepted-rule-example
- dev-fix/invokable-controller-validation
- dev-fix/299-union-return-types-oneof
- dev-fix/298-nested-array-validation-schema
- dev-fix/306-resource-structure-visitor-merge-when-crash
- dev-test/add-comprehensive-demo-app-patterns
- dev-feature/ref-validation
- dev-docs/upgrade-guide
- dev-docs/stability-document
- dev-refactor/phpstan-single-php-version
- dev-refactor/reduce-phpstan-baseline
- dev-docs/add-contributing-guide
- dev-fix/flaky-phone-test
- dev-refactor/validation-rule-collection-null-support
- dev-refactor/apply-validation-rule-collection
- dev-refactor/add-collection-base-class
- dev-test/improve-dto-coverage-phase14
- dev-test/improve-method-coverage-phase14
- dev-refactor/tag-group-dto
- dev-refactor/conditional-rule-detail-dto
- dev-refactor/conditional-rule-dto
- dev-refactor/openapi-operation-responses-dto
- dev-refactor/validation-analysis-result-dto
- dev-refactor/parameter-definition-dto
- dev-refactor/field-type-info-dto
- dev-refactor/form-request-analysis-context-dto
- dev-refactor/condition-result-dto
- dev-refactor/detected-query-parameter-dto
- dev-refactor/diagnostic-report-dto
- dev-refactor/error-entry-dto
- dev-fix/resource-detection-result-invariant-safety
- dev-refactor/resource-detection-result-dto
- dev-refactor/field-pattern-config-dto
- dev-refactor/method-signature-info-dto
- dev-refactor/type-info-dto
- dev-refactor/file-upload-analyzer-dto
- dev-refactor/inline-parameter-info-dto
- dev-refactor/apply-parameter-definition-dto
- dev-refactor/apply-controller-info-dto
- dev-refactor/apply-fractal-transformer-result-dto
- dev-refactor/apply-pagination-info-dto
- dev-refactor/apply-authentication-result-dto
- dev-refactor/apply-enum-info-dto
- dev-refactor/apply-response-info-dto
- dev-refactor/apply-resource-info-dto
- dev-refactor/apply-openapi-parameter-dto
- dev-refactor/apply-openapi-operation-dto
- dev-refactor/apply-authentication-scheme-dto
- dev-refactor/apply-openapi-response-dto
- dev-refactor/apply-request-body-dto
- dev-fix/add-openid-connect-support
- dev-refactor/fractal-auth-dto
- dev-refactor/openapi-output-dto
- dev-refactor/enum-pagination-dto
- dev-refactor/file-upload-dto
- dev-refactor/response-dtos
- dev-refactor/validation-dtos
- dev-refactor/route-info-dto
- dev-refactor/controller-info-dto
- dev-refactor/apply-dtos-to-generators
- dev-refactor/introduce-value-objects
- dev-fix/inline-validation-anonymous-class
- dev-test/improve-exporter-coverage
- dev-test/improve-live-reload-server-coverage
- dev-test/improve-generate-docs-command-coverage
- dev-feature/info-object-extension
- dev-feature/openapi-version-config
- dev-feature/parameter-style-explode
- dev-test/improve-coverage-phase14
- dev-fix/remove-plugin-documentation
- dev-test/add-mock-server-tests
- dev-docs/update-cli-and-config-references
- dev-test/improve-method-coverage-phase13
- dev-test/improve-coverage-phase11
- dev-test/improve-coverage-phase10
- dev-test/improve-coverage-phase9
- dev-test/improve-coverage-phase8
- dev-refactor/parallel-processor-testable
- dev-test/improve-coverage-phase7
- dev-test/improve-coverage-phase6
- dev-test/improve-coverage-phase5
- dev-test/improve-coverage-phase4
- dev-test/improve-coverage-phase3
- dev-test/improve-coverage-phase2
- dev-feature/schema-ref-support
- dev-feature/nullsafe-operator-support
- dev-fix/file-upload-schema
- dev-feature/demo-app-controllers
- dev-docs/claude-rules
- dev-fix/phpstan-generic-types
- dev-fix/null-check-style-consistency
- dev-fix/phpstan-strict-comparison
- dev-fix/phpstan-type-hints
- dev-feature/phpstan-level-6
- dev-fix/dependabot-webpack-dev-server
- dev-feature/codecov-optimization
- dev-gitlyte/update-site-2025-12-25T03-56-40
- dev-feature/mutation-testing
- dev-gitlyte/update-site-2025-12-25T03-01-51
- dev-feature/e2e-test-improvements
- dev-gitlyte/update-site-2025-12-25T02-47-04
- dev-feature/demo-app-e2e-testing
- dev-gitlyte/update-site-2025-12-25T02-23-25
- dev-feature/snapshot-testing
- dev-feature/openapi-spec-validation
- dev-refactor/form-request-analyzer-cleanup
- dev-refactor/type-inference-consolidation
- dev-refactor/schema-property-mapper
- dev-feature/standardize-analyzer-interfaces
- dev-refactor/remove-use-new-format-parameter
- dev-refactor/consolidate-example-generation-strategy
- dev-refactor/ast-node-value-extractor
- dev-refactor/extract-anonymous-visitors
- dev-refactor/ast-helper-traverse-method
- dev-refactor/consolidate-type-inference
- dev-refactor/extract-method-source-extractor
- dev-refactor/standardize-error-handling
- dev-refactor/extract-file-size-formatter
- dev-refactor/centralize-parser-factory
- dev-refactor/remove-unused-documentation-cache
- dev-feature/add-development-skills
- dev-refactor/fractal-transformer-use-ast-helper
- dev-refactor/extract-ast-helper
- dev-refactor/extract-analysis-setup-helper
- dev-refactor/consolidate-parsing-in-ast-extractor
- dev-gitlyte/update-site-2025-12-24T03-38-02
- dev-refactor/anonymous-class-analyzer
- dev-fix/form-request-analyzer-error-handling
- dev-refactor/form-request-ast-extractor
- dev-refactor/parameter-builder
- dev-refactor/validation-description-generator
- dev-refactor/form-request-analyzer
- dev-fix/improve-test-assertions
- dev-refactor/improve-test-coverage
- dev-feature/tag-groups-support
- dev-feature/openapi-3.1.0-support
- dev-refactor/openapi-generator-clean-architecture
- dev-feature/html-documentation-output
- dev-dependabot/npm_and_yarn/docs-site/mdast-util-to-hast-13.2.1
- dev-dependabot/npm_and_yarn/docs-site/node-forge-1.3.2
- dev-chore/update-serena-config
- dev-dependabot/npm_and_yarn/docs-site/js-yaml-3.14.2
- dev-fix/phpstan-errors
- 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-05 09:28:36 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