Home  >  Article  >  PHP Framework  >  Teach you how to use apidoc in laravel!

Teach you how to use apidoc in laravel!

藏色散人
藏色散人forward
2020-07-21 14:04:054390browse

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!

Teach you how to use apidoc in laravel!

#apidoc official documentation: http://apidocjs.com /#params

Step 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:

Teach you how to use apidoc in laravel!

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/api

as shown:

Teach you how to use apidoc in laravel!

The directory structure is as shown:

Teach you how to use apidoc in laravel!

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete