PHP code example of xianrenqh / api-doc-v2

1. Go to this page and download the library: Download xianrenqh/api-doc-v2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xianrenqh / api-doc-v2 example snippets



return [
    // 文档标题
    'title'           => 'APi接口文档',
    // 版权申明
    'copyright'       => 'Powered By HuiCMF',
    //生成文档的控制器
    'controllers'     => [
        'api\\controller\\IndexController',
    ],
    // 指定公共注释定义的文件地址
    'definitions'     => "xianrenqh\apidoc_v2\lib\Definitions",
    // 设置可选版本
    'versions'        => [
        ['title' => 'V2.0', 'folder' => ''],
    ],
    //作者
    'author'          => '小灰灰',
    // 控制器分组列表
    'groups'          => [],
    // 是否开启缓存
    'with_cache'      => false,
    // 统一的请求响应体
    'responses'       => '{
    "code":"状态码",
    "message":"操作描述",
    "data":"业务数据",
    "timestamp":"响应时间戳"
}',
    // 设置全局Authorize时请求头headers携带的key
    'global_auth_key' => "Authorization",
    // 密码验证配置
    'auth'            => [
        // 是否启用密码验证
        'with_auth'     => false,
        // 验证密码
        'auth_password' => "123456",
        // 验证请求头中apidocToken的字段,默认即可
        'headers_key'   => "apidocToken",
    ],
    // 过滤、不解析的方法名称
    'filter_method'   => [
        '_empty',
        '_initialize',
        '__construct',
        '__destruct',
        '__get',
        '__set',
        '__isset',
        '__unset',
        '__cal',
    ],
];