Reputation: 197
I have a simple website on Laravel with different types of entries and categories. I need to create documentation for him. I tried to install phpDocumentor, but it is not installed on Laravel latest version. Also I should clarify that this is not the API of the project a simple website. What other solutions do you have for automatically generating documentation?
Upvotes: 5
Views: 6341
Reputation: 77
If you want to create documentation for routes, you can try laravel-routes.
This package can be installed with composer with the next command:
composer require gussrw/laravel-routes
You can generate the HTML file from the console with the next artisan command.
php artisan route:docs
This command creates an HTML file in Project/docs.
Route description
The description is optional, but if you want to add them create a PHP comment over each route in the web.php file with @description.
/**
* @description Show the home page of the site
*/
Route::get('/home', 'HomeController@index') -> name('home.index');
Resources routes
The descriptions in the resource type routes are identified by their method in the controller.
/**
* @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');
Params
Routes params are defined with @param name Description, you can use @param in resource type routes.
/**
* @description Download photo with the photo id.
* @param id ID of the photo in database
*/
Route::get('/photo/{id}/download', 'PhotoController@download');
Upvotes: 4