2017 © Pedro Peláez
 

yii2-extension yii2doc

yii2接口文档生成

image

sheng/yii2doc

yii2接口文档生成

  • Tuesday, April 10, 2018
  • by yongshengli
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii2-doc根据action注释生成swagger所需的json文件

效果

出错了,图片找不到, (*1)

INSTALLATION

composer require sheng/yii2doc

demo

get参数可以使用query-param 也可以用request-param + http-method get request-param 会根据http-method 配置自动从请求的params 或者form中获取, (*2)

/**
 * 这个里是接口名/接口说明
 * @http-method get
 * @request-param string $business_id 业务线id required
 * @request-param string $keyword 关键字(element.code, element.name, org.id)
 * @return array
 */
 public function actionIndex(){}
/**
 * 一条业务线元素列表
 * @http-method get
 * @query-param string $business_id 业务线id required
 * @query-param string $keyword 关键字(element.code, element.name, org.id)
 * @return array
 */
 public function actionIndex(){}


form字段参数
/** * 这个里是接口名/接口说明 * @http-method post * @form-param string $business_id 业务线id required * @form-param string $keyword 关键字(element.code, element.name, org.id) * @return array */ public function actionIndex(){}
/**
 * 这个里是接口名/接口说明
 * @http-method delete
 * @request-param string $business_id 业务线id required
 * @return array
 */
 public function actionIndex(){}
/**
 * 这个里是接口名/接口说明
 * @http-method put
 * @body-param array $body httpbody required
 * @return array
 */
 public function actionIndex(){}


接口分组现在是根据controller分组的
/** * 第一行注释即为接口分组名 * */ class IndexController{}

swagger

https://swagger.io/ https://github.com/swagger-api/swagger-js, (*3)

The Versions

10/04 2018

dev-master

9999999-dev https://github.com/yongshengli/yii2-doc

yii2接口文档生成

  Sources   Download

GPL-3.0

The Requires

 

php yii2 doc api-doc

10/04 2018

v0.1

0.1.0.0 https://github.com/yongshengli/yii2-doc

yii2接口文档生成

  Sources   Download

GPL-3.0

The Requires

 

php yii2 doc api-doc