1. Go to this page and download the library: Download cdyun/webman-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/ */
namespace app\v1\controller;
use support\base\BaseController;
use OpenApi\Attributes as OA;
#[OA\Info(version: '1.0.0', title: 'V1')]
class V1BaseController extends BaseController
{
/**
* @OA\Get(
* path="/index",
* @OA\Response(response="200", description="{ 'code': 0, 'msg': 'ok' }")
* )
*/
public function index(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
...其他
}
namespace app\v2\controller;
use support\base\BaseController;
use OpenApi\Attributes as OA;
#[OA\Info(version: '2.0.0', title: 'V2')]
class V2BaseController extends BaseController
{
...其他
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.