Home > Article > PHP Framework > Teach you how to use apidoc in laravel!
The following tutorial column of Laravel will introduce to you how to use apidoc in laravel. I hope it will be helpful to friends in need!
#apidoc official documentation: http://apidocjs.com /#paramsStep one: Use:npm install apidoc -g
command to install apidoc.
Step 2: Create a new
apidoc.json file in the project root directory. The file content format is as follows:
{ "name": "laravel5 API文档", "version": "v1.0", "description": "本文档提供laravel5 商品,订单,收货地址,等API文档供嗨聊服务端开发人员作为参考,文档使用RESTfull风格,如有疑问请联系开发者", "apidoc": { "title": "laravel5 API文档", "url" : "http://http://www.learnlaravel5.com//api" }}As shown in the figure: Three steps: Use
apidoc -i myapp/ -o apidoc/ -t mytemplate/"
其中: -i 表示输入,后面是文件夹路径-o 表示输出,后面是文件夹路径默认会带上-c,在当前路径下寻找配置文件(apidoc.json),如果找不到则会在package.json中寻找 "apidoc": { } myapp/ 表示要生成api的源文档所在目录位置 mytemplete/ 表示要生成api到的目录位置For example: I want to
app/Http/Controllers/Api/ The command to generate api files from documents in the directory to
public/api is as follows:
apidoc -i app/Http/Controllers/Api/ -o public/apias shown: The directory structure is as shown:
The above is the detailed content of Teach you how to use apidoc in laravel!. For more information, please follow other related articles on the PHP Chinese website!