php使用户apidoc生成接口文档,apidoc安装,apidoc生成接口文档
1.安装nodjs
下载地址:http://nodejs.cn/download/
2.安装apidoc
npm install apidoc -g
3.配置apidoc json文件例如我们这里放到项目根目录
{
"name": "example",
"version": "0.1.0",
"description": "apiDoc basic example",
"apidoc": {
"title": "Custom apiDoc browser title",
"url" : " //这个地址是你以后要访问的接口地址
}
}4.给接口添加文档,添加在Controller入口方法前面。这个的参数可以查看官网
/**
* @api {get} /user/:id Request User information
* @apiName GetUser
* @apiGroup User
*
* @apiParam {Number} id Users unique ID.
*
* @apiSuccess {String} firstname Firstname of the User.
* @apiSuccess {String} lastname Lastname of the User.
*/5.执行生成命令 我这里进入了项目根目录app/Http/Controllers是控制的地址路径这样就会在根目录生成了
apidoc -i app/Http/Controllers -o apidoc/
6.访问项目访问地址+apidoc就可以访问了
本文由:xiaoshu168.com 作者:xiaoshu发表,转载请注明来源!