美文网首页PHP
PHP 注释 CENTOS 环境 通过 PHP_DOC 生成文

PHP 注释 CENTOS 环境 通过 PHP_DOC 生成文

作者: ___n | 来源:发表于2018-01-25 14:13 被阅读21次

    下载 node

    wget -c https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.gz
    tar -zxf node-v8.0.0-linux-x64.tar.gz
    

    将 node/bin 加入到环境变量

    
    vi /etc/profile
    
    ...
    PATH=$PATH:/opt/node/node-v8.0.0-linux-x64/bin
    ...
    
    

    WARNING: C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=g++)
    如果下载了安装版本,安装时出现上面的错误,表示你的gcc-c++版本太老了,要升级到才行,可以去这里下载 http://ftp.gnu.org/gnu/gcc/

    这装时需要需要三个额外库gmp、mpfr、mpc,
    mpc 可以去 http://www.multiprecision.org/mpc 下载,
    前面两个在 http://ftp.gnu.org/gnu 都可以找到

    全局安装 apidoc

    npm install apidoc -g
    
    # 安装完成后执行 apidoc -h 可以查看命令
    

    命令参数说明

    -f, --file-filters [.*.(clj|cls|coffee|cpp|cs|dart|erl|exs?|go|groovy|ino?|java|js|jsx|kt|litcoffee|lua|p|php?|pl|pm|py|rb|scala|ts|vue)$]

    参数 描述
    -f, --file-filters RegEx-Filter to select files that should be parsed (multiple -f can be used).
    -e, --exclude-filters RegEx-Filter to select files / dirs that should not be parsed (many -e can be used). []
    -i, --input Input / source dirname. [./]
    -o, --output Output dirname. [./doc/]
    -t, --template Use template for output files. [/opt/node/node-v8.0.0-linux-x64/lib/node_modules/apidoc/template/]
    -c, --config Path to directory containing config file (apidoc.json) [./]
    -p, --private Include private APIs in output. [false]
    -v, --verbose Verbose debug output. [false]
    -h, --help Show this help information.
    --debug Show debug messages. [false]
    --color Turn off log color. [true]
    --parse Parse only the files and return the data, no file creation. [false]
    --parse-filters Optional user defined filters. Format name=filename
    --parse-languages Optional user defined languages. Format name=filename
    --parse-parsers Optional user defined parsers. Format name=filename
    --parse-workers Optional user defined workers. Format name=filename
    --silent Turn all output off. [false]
    --simulate Execute but not write any file. [false]
    --markdown Turn off default markdown parser or set a file to a custom parser. [true]
    --line-ending Turn off autodetect line-ending. Allowed values: LF, CR, CRLF.
    --encoding Set the encoding of the source code. [utf8]. [utf8]

    创建JSON 配置 (apidoc.json)

    {
    "name": "example",
    "version": "0.1.0",
    "description": "apiDoc basic example",
    "title": "Custom apiDoc browser title",
    "url" : "https://api.github.com/v1"
    }

    执行

    apidoc -i 需要生成的项目目录/ -o ./输出的目标目录

    官方网站

    `
    http://apidocjs.com/

    注释示例

    
    /**
     * @api {get} /user/:id Request User information
     * @apiName GetUser
     * @apiGroup User
     *
     * @apiParam {Number} id Users unique ID.
     *
     * @apiSuccess {String} firstname Firstname of the User.
     * @apiSuccess {String} lastname  Lastname of the User.
     */
    
    
    /**
     * @api {get} /user/:id Get User information and Date of Registration.
     * @apiVersion 0.2.0
     * @apiName GetUser
     * @apiGroup User
     *
     * @apiParam {Number} id Users unique ID.
     *
     * @apiSuccess {String} firstname  Firstname of the User.
     * @apiSuccess {String} lastname   Lastname of the User.
     * @apiSuccess {Date}   registered Date of Registration.
     *
     * @apiSuccessExample Success-Response:
     *     HTTP/1.1 200 OK
     *     {
     *       "firstname": "John",
     *       "lastname": "Doe"
     *     }
     *
     * @apiError UserNotFound The id of the User was not found.
     *
     * @apiErrorExample Error-Response:
     *     HTTP/1.1 404 Not Found
     *     {
     *       "error": "UserNotFound"
     *     }
     */
    
    

    相关文章

      网友评论

        本文标题:PHP 注释 CENTOS 环境 通过 PHP_DOC 生成文

        本文链接:https://www.haomeiwen.com/subject/iilvaxtx.html