Automatically generate Laravel docs from request rules, controllers and routes
rakutentech/laravel-request-docs is a Laravel package for automatically generate laravel docs from request rules, controllers and routes.
It currently has 782 GitHub stars and 1.353.853 downloads on Packagist (latest version v2.44).
Install it with composer require rakutentech/laravel-request-docs.
Discover more Laravel packages by rakutentech
or browse all Laravel packages to compare alternatives.
Last updated
The Hassle-Free automatic API documentation generation for Laravel.
A Swagger alternative.
Supports Open API 3.0.0
Try latest DEMO!
Fast Install on any Laravel Project
Hassle Free Auto Generate API Documentation for request rules and parameters
Analyze Inbuilt SQL query time analyzer, response time and headers output.
Supports Postman and OpenAPI 3.0.0 exports.
Automatically generate API documentation for Laravel without writing annotations.
Read more: https://medium.com/web-developer/laravel-automatically-generate-api-documentation-without-annotations-a-swagger-alternative-e0699409a59e
| Lang | Versions | | :------ |:--------------------------| | PHP | 7.4 or 8.0 or 8.1 or 8.2 | | Laravel | 6.* or 8.* or 9.* or 10.* |
You can install the package via composer:
composer require rakutentech/laravel-request-docs
You can publish the config file with:
php artisan vendor:publish --tag=request-docs-config
php artisan route:cache
# Optional publish assets
# php artisan vendor:publish --tag=request-docs-assets
(optional) Add the following middleware to your API, so that the SQL logs and model events are captured.
app/Http/Kernel.php
'api' => [
...
\Rakutentech\LaravelRequestDocs\LaravelRequestDocsMiddleware::class,
... and so on
View in the browser on /request-docs/
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.

Dark and Light Modes
Settings to sort, group and filter
You can write extra documentation in markdown using @lrd in the PHPDoc on the rules method of the Request classes and on the controller methods.
This will then be rendered as HTML on the dashboard.
Documentation defined on the controller method is appended below documentation defined on the rules method.
Example of using it in the controller:
/**
* @lrd:start
* # Hello markdown
* Free `code` or *text* to write documentation in markdown
* @lrd:end
*/
public function index(MyIndexRequest $request): Resource
{
You define extra parameters using @LRDparam.
You can use @LRDparam in PHPDoc on both the rules methods and the controller methods.
You can also overwrite rules using @LRDparam.
Meaning, when rules are defined in the rules method, you can overwrite those rules using @LRDparam in the PHPDoc above the rules method.
And you can overwrite those rules using @LRDparam in a PHPDoc on the controller methods.
So, the precedence is Controller method PHPDoc < Rules method PHPDoc < Rules method values.
/**
* @LRDparam username string|max:32
* // either space or pipe
* @LRDparam nickaname string|nullable|max:32
* // override the default response codes
* @LRDresponses 200|422
*/
public function index(MyIndexRequest $request): Resource
{
Without explicitly declaring response codes,
all routes are documented to return any of the response codes defined in the request-docs.php default_responses configuration.
However, using @LRDresponse 200|422 (spaces or pipes) within the PHPDoc on your controller methods,
you are able to explicitly define what status codes can be returned by the server.
Please view the request-docs.php config file to see how you can customise your experience.
./vendor/bin/phpunit
./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/
@QAParam is now @LRDparamlaravel-request-docs:export command to exportrules method of the Request class. By @Ken-vdE