Documentation of Laravel Routes
This project generates a documentation for your routes of a laravel project, generates a html file with the description for each route, description include:, (*1)
All this with a simple artisan command., (*2)
This package can be installed with composer with the next command:, (*3)
composer require gussrw/laravel-routes
, (*4)
You can generate the html file from console with the next artisan command., (*5)
php artisan route:docs
, (*6)
This command create a html file in Project/docs., (*7)
Description are optional, but if you want to add them create a php comment over the each route in the web.php file with @description
., (*8)
/** * @description Show the home page of the site */ Route::get('/home', 'HomeController@index') -> name('home.index');
The descriptions in the resource type routes are identified by their method in the controller., (*9)
/** * @index Show the main view * @create Show the view to create a photo * @store Save a photo in database * @edit Show the view to edit a photo * @update Update photo data in database * @destroy Delete a photo in database */ Route::resource('photos', 'PhotoController');
Routes params are defined with @param name Description
, you can use @param in resource type routes., (*10)
/** * @description Download photo with the photo id. * @param id ID of the photo in database */ Route::get('/photo/{id}/download', 'PhotoController@download');
To show the documentation in another language, you can use option --lang
, default is en
, (*11)
php artisan route:docs --lang=es
, (*12)
Languages currently available:, (*13)
To indicate the html file path, you can use option --path
, default is /docs
, (*14)
php artisan route:docs --path=/routes/docs
, (*15)
To show only the routes that have a comment, you can use the option --commented
, default is false
, (*16)
php artisan route:docs --commented=true
, (*17)
To sort the routes by some property, you can use the option --sortby
,default is uri
, (*18)
php artisan route:docs --sortby=name
, (*19)
Properties available to order:, (*20)