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