dilneiss / laravel-request-docs
Automatically generate Laravel docs from request rules, controllers and routes
Installs: 171
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 106
Language:Blade
Requires
- php: ^7.4|^8.0
- illuminate/contracts: ^8.37|^9.0|^10.0|^11.0|^12.0
- kitloong/laravel-app-logger: ^1.0
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- friendsofphp/php-cs-fixer: ^3.5
- nunomaduro/collision: ^5.3|^6.0
- orchestra/testbench: ^6.15|^7.0
- phpunit/phpunit: ^9.3
- spatie/laravel-ray: ^1.23
- squizlabs/php_codesniffer: ^3.6
- vimeo/psalm: ^4.8
README
The Hassle-Free automatic API documentation generation for Laravel.
A Swagger alernative.
Fast: Install on any Laravel Project
Hassle Free: Auto Generate API Documentation for request rules and parameters
Analyze: In build SQL query time analyzer, response time and headers output.
Features
- Automatic routes fetching from Laravel Routes
- Automatic rules fetching from injected Request
- Support for Authorization Headers
- Support for SQL query, response time and memory consumption by request on Laravel
- Intelligent auto request builder using
faker.js
- Display extra documentation using markdown
Read on Medium
Automatically generate api documentation for Laravel without writing annotations.
Requirements
Installation
You can install the package via composer:
composer require rakutentech/laravel-request-docs --dev
You can publish the config file with:
php artisan vendor:publish --tag=request-docs-config
Usage
View in the browser on /request-docs/
or generate a static HTML
php artisan lrd:generate
Docs HTML is generated inside docs/
.
Design pattern
In order for this plugin to work, you need to follow the design pattern by injecting the request class inside the controller. For extra documentation you can use markdown inside your controller method as well.
Screenshots
Generated API documentation
Try API
SQL query profile
Resonse profile
Customize Headers
Extra
You write extra documentation in markdown which will be rendered as HTML on the dashboard. Example of using it in controller
/** * @lrd:start * #Hello markdown * ## Documentation for /my route * @lrd:end */ public function index(MyIndexRequest $request): Resource {
Testing
./vendor/bin/phpunit
Linting
./vendor/bin/phpcs --standard=phpcs.xml --extensions=php --ignore=tests/migrations config/ src/
Fixing lints
./vendor/bin/php-cs-fixer fix src/ ./vendor/bin/php-cs-fixer fix config/
Changelog
- Initial Release
- v1.9 Added improvements such as status code, response headers, custom request headers and fixed issues reported by users
- v1.10 Show PHP memory usage, gzip encoding fix
- v1.12 Bug Fix of id, and Laravel 9 support
- v1.13 Laravel 9 support
- v1.15 Adds Filter and fall back to regexp upon Exception