PHP code example of jkbennemann / laravel-api-documentation
1. Go to this page and download the library: Download jkbennemann/laravel-api-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/ */
jkbennemann / laravel-api-documentation example snippets
# SampleLoginController.php
use JkBennemann\LaravelApiDocumentation\Attributes\Tag;
//..
#[Tag('Authentication')]
public function login()
{
//...
}
# SampleLoginController.php
use JkBennemann\LaravelApiDocumentation\Attributes\Summary;
//..
#[Summary('Login a user')]
public function login()
{
//...
}
# SampleLoginController.php
use JkBennemann\LaravelApiDocumentation\Attributes\Description;
//..
#[Description('Logs an user in. <br> This route
# SampleController.php
use JkBennemann\LaravelApiDocumentation\Attributes\AdditionalDocumentation;
//..
#[AdditionalDocumentation(url: 'https://example.com/docs', description: 'External documentation')]
public function index()
{
//...
}
# SampleController.php
use JkBennemann\LaravelApiDocumentation\Attributes\DataResponse;
//..
#[DataResponse(200, description: 'Logged in user information', resource: UserResource::class, headers: ['X-Token' => 'Token for the user to be used to issue API calls',])]
#[DataResponse(401, description: 'Failed Authentication', resource: ['error' => 'string'])]
public function index()
{
//...
}