PHP code example of xwpd / thinkphp-apidoc-generator

1. Go to this page and download the library: Download xwpd/thinkphp-apidoc-generator 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/ */

    

xwpd / thinkphp-apidoc-generator example snippets


    return [
        //...其他命令
        "api-doc:generate"=>Yunbuye\ThinkApiDoc\Commands\GenerateDocumentation::class
    ];
    

    /**
    * 其他注释后,空行
    *
    * @resource 例子分组,分组名称后必须空行
    *
    */
   class MessagesController
    

   /**
    * 控制器标题,标题后必须有一个空行
    *
    * 其他描述备注,必须与标题隔开一行
    * 
   */
   

    /**
     * 某接口名称
     *
     * 文本描述,或者其他描述,比如json
     * {
     *      company_id: '必传',
     *      sale_desc: '按销量降序',
     *      price_desc: '按价格降序',
     *      price_asc: '按价格升序'
     *  }
     * @param string $name
     * @return string
     */
   
bash
    php think api-doc:generate --routePrefix=*
   
bash
        php think api-doc:generate -h
    

        /**
       * 创建公司
       *
       * 创建后,需要设置接收通知的职员
       */
     public function save(app\common\validate\Save $validate)
        {
     
       }