PHP code example of xianrenqh / api-doc-php
1. Go to this page and download the library: Download xianrenqh/api-doc-php 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-php example snippets
// 引入扩展(具体路径请根据你的目录结构自行修改)
namespace app\index\controller;
use xianrenqh\apidoc\ApiDoc;
use think\Controller;
class Doc
{
public function index()
{
$config = [
'class' => [
'app\\index\\controller\\Api',
], // 要生成文档的类
'filter_method' => ['__construct', '_empty'], // 要过滤的方法名称
];
$api = new \xianrenqh\apidoc\BootstrapApiDoc($config);
$doc = $api->getHtml();
exit($doc);
}