定制 eold/yii2-apidoc-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eold/yii2-apidoc-generator

最新稳定版本:v1.0.2

Composer 安装命令:

composer require eold/yii2-apidoc-generator

包简介

A simple comments generator in Apidoc.js format for your yii2 RESTFul API's

README 文档

README

Yii2 Apidoc.js generator

Yii2 Apidoc.js generator is a little helper that generate Apidoc.js comments for your yii2 RESTFul API actions on-demand. Just call your API's endpoints to generate the comment files. Then run apidoc scripts to generate your documentation.

PREREQUISITES

Install Apidoc.js (http://apidocjs.com/)

npm install apidoc -g

ADD APIDOC GENERATOR IN YOUR PROJECT

 "eold/yii2-apidoc-generator": "^1.0."

CONFIGURE

Put apidoc-generator in your Yii2 config file components

'docGenerator' =>[
            'class' => 'eold\apidocgen\src\ApiDocGenerator',
            'isActive'=>true,                      // Flag to set plugin active
            'versionRegexFind'=>'/(\w+)(\d+)/i',   // regex used in preg_replace function to find Yii api version format (usually 'v1', 'vX') ... 
            'versionRegexReplace'=>'${2}.0.0',     // .. and replace it in Apidoc format (usually 'x.x.x')
            'docDataAlias'=>'@runtime/data_path'   // Folder to save output. make sure is writable. 
        ],

Then, add apidoc-generator in bootstrap section

'bootstrap' => ['log', 'v1', 'docGenerator'],

USAGE

Everytime you call an endpoint of your API's, ApiDocGenerator try to writes the corresponding Apidoc.js comment file. If an output file was already generated it will NOT be overwrited. You have to delete it and call the endpoint again.

Then, you have to call Apidoc.js to generate the doc

apidoc -i <PATH_TO_YII2_APIDOC_GENERATOR_DATA_ALIAS> -o <PATH_TO_YOUR_GENERATED_DOCS>

统计信息

  • 总下载量: 9.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2015-07-20