1 Star 0 Fork 15

白纸 / api-doc

forked from 风情万种 / api-doc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

#api-doc

使用方法

####1、安装扩展

composer require weiwei/api-doc dev-master

由于我没发布版本,所有暂时需带dev-master安装

####2、配置参数 安装好扩展后在 application\extra\ 文件夹下会生成 doc.php 配置文件 在controller参数中添加对应的类

    'controller' => [
        'app\\api\\controller\\Demo'
    ]

####3、在相关接口类中增加注释参数 方法如下:返回参数支持数组及多维数组

<?php
/**
 * @title 测试demo
 * @description 接口说明
 */
class demo
{
    /**
     * @title 测试demo接口
     * @description 接口说明
     * @author 开发者
     * @url /api/demo
     *
     * @param name:id type:int require:1 default:1 other: desc:唯一ID
     *
     * @return name:名称
     * @return mobile:手机号
     * @return list_messages:消息列表@
     * @list_messages message_id:消息ID content:消息内容
     * @return object:对象信息@!
     * @object attribute1:对象属性1 attribute2:对象属性2
     * @return array:数组值#
     * @return list_user:用户列表@
     * @list_user name:名称 mobile:手机号 list_follow:关注列表@
     * @list_follow user_id:用户id name:名称
     */
    public function index()
    {
        //接口代码
    }

}

####4、在浏览器访问http://你的域名/doc 查看接口文档

####5、预览

###更多支持

  • QQ1763692101

###问题 不少小伙伴反应,没有正常安装doc.php 配置文件,原因是你改过应用目录官方默认是application 如果没有生成doc.php 配置文件 你可以手动安装,直接在application(你修改的目录)里面创建extra文件夹,然后把扩展包中的vendor\weiwei\api-doc\src\config.php文件复制进去,并重命名为doc.php

The MIT License (MIT) Copyright (c) 2017 风情万种 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

The ThinkPHP5 Api Doc Package 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/993/api-doc.git
git@gitee.com:993/api-doc.git
993
api-doc
api-doc
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891