Download the PHP package provydon/docs-generate without Composer
On this page you can find all versions of the php package provydon/docs-generate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download provydon/docs-generate
More information about provydon/docs-generate
Files in provydon/docs-generate
Package docs-generate
Short Description Automatic API documentation for your Laravel app โ zero annotations, OpenAPI 3.0 JSON & Swagger UI.
License MIT
Informations about the package docs-generate
โจ Why Docs Generate?
Stop writing documentation manually! This package automatically generates beautiful Swagger/OpenAPI documentation from your existing Laravel codeโno annotations, no code pollution, no maintenance headaches.
๐ฏ Perfect For:
- Laravel APIs that need professional documentation
- Teams who want docs that stay in sync with code
- Developers who hate writing documentation
- Projects that need client-ready API docs
๐ Quick Start
Get documented instantly:
That's it! ๐ Your API is now fully documented.
๐ Use with Any API Client
The generated JSON is compatible with all major API clients:
Import into your favorite tools:
- ๐ฎ Postman - Import OpenAPI 3.0 JSON
- ๐ Insomnia - Import OpenAPI spec
- ๐ Thunder Client - VS Code extension
- ๐ฅ Bruno - Open-source API client
- ๐ฑ Any OpenAPI-compatible tool
Code changes โ run command โ docs automatically reflect changes
๐ Documentation Stays in Sync
The best part? Your documentation automatically stays up-to-date with your code:
- Make code changes โ Add new routes, update controllers, modify validation
- Run
php artisan docs:generateโ Regenerates the documentation - Deploy your code โ Documentation file goes with your code
- Documentation is always current โ No manual updates needed!
The docs.json file lives in your public/ folder, so it's part of your project and gets deployed with every code update. Your API documentation will always reflect your latest code changes.
๐งฑ Always Auto Update Your Documentation
Add php artisan docs:generate to your deployment script or build pipeline so every release ships with freshly generated docs:
You can even surface the progress logs in your CI/CD output:
โจ What You Get
โ Manual maintenance
โ Outdated docs | โ Beautiful Swagger UI
โ Auto-generated from code
โ Always up-to-date |
๐จ Beautiful Swagger UI
- Modern, responsive design
- Interactive "Try it out" functionality
- Professional API explorer
- Mobile-friendly interface
๐ Zero Maintenance
- Auto-detects your routes, validation, and auth
- Stays in sync with your code changes
- No annotations to maintain
- Regenerate with one command
๐ก๏ธ Production Ready
- Configurable authentication
- CORS handling included
- Error handling built-in
- Laravel-native integration
๐ฏ Key Features
๐ Requirements
- PHP 8.1+ (Laravel 13 requires PHP 8.3+ on the host app, matching
laravel/framework) - Laravel 9.0 through 13.x
๐ ๏ธ Installation
Step 1: Install via Composer
Step 2: Publish Configuration
This creates:
config/docs-generate.php- Configuration fileresources/views/vendor/docs-generate/- Swagger UI view
Step 3: Generate Documentation
Step 4: View Your Documentation
Navigate to: http://your-app-url/docs
๐จ Authentication
Documentation Access Control
Control who can access your API documentation:
API Authentication Detection
The package automatically detects authentication requirements by checking for these middleware:
authauth:sanctumauth:apisanctum- Any middleware containing
Authenticate
โ๏ธ Configuration
Route Configuration
Customize your documentation routes:
API Information
Edit config/docs-generate.php:
๐ Output File
The generated API documentation is saved as public/docs.json in your Laravel project. This approach offers several benefits:
- Always Accessible: File is in the public folder, accessible via web server
- Stays with Code: Documentation file is part of your project and version controlled
- Auto-Updates: Latest docs automatically follow code updates when you deploy
- Part of Project: Included in version control and deployments
- CDN Ready: Can be served via CDN for better performance
- Simple: No complex storage configuration needed
Direct Access:
Via Route (with error handling):
๐ง How It Works
1. Route Analysis
Scans all Laravel routes with the api/ prefix and extracts:
- HTTP methods (GET, POST, PUT, DELETE, etc.)
- URI patterns and parameters
- Controller and method names
- Applied middleware (for auth detection)
2. Validation Extraction
For each route, it inspects the controller method:
- Identifies FormRequest classes in method parameters
- Detects inline
$request->validate()calls in method body - Extracts validation rules from both sources
- Converts rules to OpenAPI schema definitions
3. Smart Type Detection
Based on field names and validation rules, it automatically detects:
emailfields โ format: emailpasswordfields โ format: password, minLength: 8phonefields โ format: phoneurlfields โ format: uridatefields โ format: dateuuidfields โ format: uuidimage/filefields โ format: binary
4. Authentication Detection
Automatically adds security requirements if route has:
authmiddlewareauth:sanctummiddlewareauth:apimiddlewaresanctummiddleware- Any middleware containing
Authenticate
๐ Examples
Example 1: FormRequest Validation
Laravel Code:
Generated Swagger:
Example 2: Inline Validation
Laravel Code:
Generated Swagger:
๐ Commands
Generate Documentation
Generates fresh API documentation from your current routes and controllers.
๐ ๏ธ Troubleshooting
Documentation not showing?
Make sure you've run:
Routes not appearing?
Check that routes have the api/ prefix:
404 on /docs?
Clear route cache:
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
โ Support
If this package helped you, consider buying me a coffee to support development!
All versions of docs-generate with dependencies
illuminate/console Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/validation Version ^9.0|^10.0|^11.0|^12.0|^13.0