First of all, please make sure you have some basic concepts of Swagger OpenAPI and Swagger UI.
Then you can start with following steps:
composer require tanghengzhi/yii2-swagger --dev
//config/web.php
$config = [
...
'modules' => [
'swagger' => [
'class' => 'tanghengzhi\swagger\Module',
],
],
...
]
'swagger'=>[
'scan_dir'=>[
'app/controllers',
]
]