avtehnik/service-doc
最新稳定版本:v0.1.3
Composer 安装命令:
composer require avtehnik/service-doc
包简介
service-doc - Generate interactive documentation for your RESTful API using phpdoc annotations
README 文档
README
composer require avtehnik/service-doc
Usage
Add annotations to your php files.
/** * @ServiceDoc\Info(title="My First API", version="0.1") */ /** * @ServiceDoc\PathItem( * microservice="payment", * path="/wallet-prices", * method="get", * @ServiceDoc\Tag( * name="user", * ) * ) * @param $destination_code * @param $source_code * * @return */
Usage from Yii
Add servicedoc section to actions array
class DocumentationController extends Controller { public function actions() { return [ 'servicedoc' => [ 'class' => 'ServiceDoc\YiiServiceDocAction', 'scanDir' => [ Yii::getAlias('@common/components') ], ], ]; } }
and then you can access to docs with url /documentation/servicedoc
Usage from php
Generate always-up-to-date documentation.
<?php require("vendor/autoload.php"); $swagger = \ServiceDoc\scan(__DIR__); header('Content-type: application/json; charset=utf-8'); echo $swagger->toJson();
统计信息
- 总下载量: 7.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-05-01