PHP code example of andrii-hrechyn / auto-documentation
1. Go to this page and download the library: Download andrii-hrechyn/auto-documentation 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/ */
andrii-hrechyn / auto-documentation example snippets
// Create documentation for path
Path::get('/your/api/{endpoint}', 'Your endpoint name')
->group('Some group')
->tag('Some tag') // or ->tags(['First tag', 'Second tag'])
->parameters([
PathParameter::make('endpoint')
->Property::make('one_more_property'),
])
->successfulResponse([
StringProperty::make('message')->example('Success response'),
])
->secure();
// Or you can use existing schemas
Path::get('/your/api/endpoint', 'Your endpoint name')
->group('Some group')
->tag('Some tag') // or ->tags(['First tag', 'Second tag'])
->parameters([ExampleParameter::make()])
->jsonRequest(ExampleSchema::make())
->successfulResponse(ExampleSchema::make())
->secure();
//Also you can do that for routes
Route::make('name.of.your.route', 'Example route')
->group('Some other group')
->tag('Other tag')
->requestBodyFromRequestClass() // Get request body from validation rules in request class
->successfulResponse(ExampleSchema::make())
->secure();