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

Teach you how to use apidoc in laravel!

藏色散人
Release: 2020-07-21 14:04:27
forward
4447 people have browsed it

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"
  }}
Copy after login

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到的目录位置
Copy after login

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
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template