wadakatu/laravel-spectrum

Zero-annotation API documentation generator for Laravel and Lumen


README

Laravel Spectrum Banner

Tests Code Coverage Latest Stable Version Total Downloads License

🎯 Zero-annotation API documentation generator for Laravel & Lumen

Laravel Spectrum analyzes your existing code and automatically generates OpenAPI 3.0 documentation. No annotations required, minimal configuration, ready to use immediately.

✨ Why Laravel Spectrum?

Stop writing documentation. Start generating it.

  • 🚀 Zero Configuration - Just install and run the command
  • 🧠 Smart Detection - Automatically analyzes FormRequests, validation rules, and API Resources
  • Real-time Updates - Instantly reflects code changes in documentation
  • 📤 Export Features - Direct export to Postman and Insomnia
  • 🎭 Mock Server - Automatically launches mock API from OpenAPI documentation
  • 🎯 Production Ready - High-performance even for large-scale projects

🚀 Quick Start

1. Installation

composer require wadakatu/laravel-spectrum --dev

2. Generate Documentation

php artisan spectrum:generate

3. Live Preview (Development)

php artisan spectrum:watch
# Visit http://localhost:8080 to see your documentation

4. View in Browser

<!-- Add to your Blade template -->
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<script>
SwaggerUIBundle({
    url: "/storage/app/spectrum/openapi.json",
    dom_id: '#swagger-ui',
})
</script>

5. Launch Mock Server

php artisan spectrum:mock
# Mock API server launches at http://localhost:8081

That's it! Your comprehensive API documentation is ready in seconds.

📚 Documentation

📖 View Full Documentation

For detailed usage and advanced features, visit our comprehensive documentation site.

The documentation covers:

  • 🔧 Getting Started - Installation, configuration, basic usage
  • 🎯 Features Guide - Validation detection, response analysis, authentication, mock server
  • Advanced Usage - Performance optimization, export features, CI/CD integration
  • 📖 Reference - CLI commands, configuration options, troubleshooting
  • 🤝 More - Comparison with other tools, contribution guide

🤝 Contributing

We welcome bug reports, feature requests, and pull requests! See the Contribution Guide for details.

📄 License

Laravel Spectrum is open-source software licensed under the MIT license. See the LICENSE file for details.

Made with ❤️ by Wadakatu

Star on GitHub