2017 © Pedro Peláez
 

yii2-extension yii2-swagger

Swagger 扩展

image

huijiewei/yii2-swagger

Swagger 扩展

  • Monday, July 9, 2018
  • by huijiewei
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

yii2-swagger

Yii2 Swagger 扩展, (*1)

安装

composer require huijiewei/yii2-swagger

用法

Controller 里面集成 Action:
public function actions()
{
    return [
        'ui' => [
            'class' => 'huijiewei\swagger\actions\SwaggerUiAction',
            'apiUrl' => \yii\helpers\Url::to(['/site/api'], true),
        ],
        'api' => [
            'class' => 'huijiewei\swagger\actions\SwaggerApiAction',
            'scanDir' => '扫描的目录,可以是数组,支持 yii 的 alias',
        ],
    ];
}
Module 里面集成 Controller:
public function init()
{
    parent::init();

    $this->controllerMap = [
        'swagger' => [
            'class' => 'huijiewei\swagger\SwaggerController',
            'apiOptions' => [
                'scanDir' => '扫描的目录,可以是数组,支持 yii 的 alias',
                'defines' => [ // 可以定义一些常量,具体查阅 swagger-php 文档
                    'API_HOST' => 'API_HOST',
                    'API_BASE_PATH' => 'BASE_PATH'
                ]
            ],
            'uiOptions' => [
                'apiUrlRoute' => 'swagger/api'
            ]
        ],
    ];
}

更多文档

查阅 Swagger PHP 文档., (*2)

查阅 Swagger UI 文档., (*3)

感谢 swagger-php swagger-ui, (*4)

The Versions

09/07 2018

dev-master

9999999-dev

Swagger 扩展

  Sources   Download

MIT

The Requires

 

by Huijie Wei

09/07 2018

2.0.3

2.0.3.0

Swagger 扩展

  Sources   Download

MIT

The Requires

 

by Huijie Wei

08/07 2018

2.0.2

2.0.2.0

Swagger 扩展

  Sources   Download

MIT

The Requires

 

by Huijie Wei

08/07 2018

v2.0.1

2.0.1.0

Swagger 扩展

  Sources   Download

MIT

The Requires

 

by Huijie Wei