1. Go to this page and download the library: Download fillincode/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/ */
use Fillincode\Swagger\Attributes\Group;
#[Group('group_name')]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\Summary;
#[Summary('summary')]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\Description;
#[Description('description')]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\Code;
#[Code(201, 'Object update')]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\PathParameter;
#[PathParameter('parameter_name', 'enum', 'description parameter', ['string_1', 'string_2', 12], false)]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\QueryParameter;
#[QueryParameter('parameter_name', 'string', 'example_string', 'description parameter')]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\Resource;
#[Resource(ProjectResource::class)]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\FormRequest;
#[FormRequest(FormRequest::class)]
public function example_method()
{
//
}
use Fillincode\Swagger\Attributes\Property;
#[Property('age', 'integer', 'student age')]
class ProjectRequest extends FormRequest
{
//
}
use Fillincode\Swagger\Attributes\Property;
#[Property('id', 'string', 'user id')]
#[Property('data.info_1', 'string', 'user info 1')]
#[Property('data.info_2', 'string', 'user info 2')]
class UserResource extends JsonResource
{
public function toArray(Request $request)
{
return [
'id' => $this->id,
'data' => [
'info_1' => $this->data['info_1'],
'info_2' => $this->data['info_2'],
]
]
}
}