1. Go to this page and download the library: Download freedomcore/laravel-swagger library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
freedomcore / laravel-swagger example snippets
/**
* You can also do this, first line will be "summary"
*
* And anything 1 * apart from the "summary" will count as "description"
*
* @Request({
* summary: Title of the route,
* description: This is a longer description for the route which will be visible once the panel is expanded,
* tags: Authentication,Users
* })
*/
public function someMethod(Request $request) {}
/**
* @Response({
* code: 302
* description: Redirect
* })
* @Response({
* code: 400
* description: Bad Request
* })
* @Response({
* code: 500
* description: Internal Server Error
* })
*/
public function someMethod(Request $request) {}
$rules = [
'locale' => 'swagger_default:en_GB'
];
$rules = [
'page' => 'swagger_default:1|swagger_min:1', // This will simply display the 'minimum' value in the documentation
'page' => 'swagger_default:1|swagger_min:1:fail' // This will also fail if the `page` parameter will be less than 1
];
$rules = [
'take' => 'swagger_default:1|swagger_min:1|swagger_max:50', // This will simply display the 'maximum' value in the documentation
'take' => 'swagger_default:1|swagger_min:1|swagger_max:50:fail' // This will also fail if the `take` parameter will be greater than 50
];