1. Go to this page and download the library: Download ez-php/openapi 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 EzPhp\OpenApi\Attributes\ApiOperation;
use EzPhp\OpenApi\Attributes\ApiParam;
use EzPhp\OpenApi\Attributes\ApiResponse;
final class UserController
{
#[ApiOperation(summary: 'List users', tags: ['users'])]
#[ApiResponse(200, 'List of users')]
#[ApiParam('search', 'string', 'query', false, 'Filter by name')]
public function index(Request $request): Response { ... }
#[ApiOperation(summary: 'Get user')]
#[ApiResponse(200, 'The user', UserSchema::class)]
#[ApiResponse(404, 'Not found')]
#[ApiParam('id', 'integer', 'path', true, 'The user ID')]
public function show(Request $request): Response { ... }
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.