PHP code example of siam / php-docs

1. Go to this page and download the library: Download siam/php-docs 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/ */

    

siam / php-docs example snippets




use Siam\Docs\Doc\Render;
use think\Container;

send();

// 主要是修改上面几行,下面是跟组件默认脚本步骤一致的
// 以上内容来源:TP的入口文件,入口文件即调用了框架初始化功能。我们复制过来即可

$array = $argv;
array_shift($array);
$file = array_shift($array);
if(empty($file)){
    $file = 'App/HttpController'; // 如果不传递目录名 则默认扫描的目录
}

$extra = array_shift($array);
if(!empty($extra) && is_file($extra)){
    $extra = file_get_contents($extra);
}else{
    $extra = null;
}

echo "scan dir: {$file}\n";

$string = Render::renderDir($file,$extra);

if(!empty($string)){
    file_put_contents('easy_doc.html',$string);
    echo "extra to  file: easy_doc.html\n";
}else{
    echo "no any api doc found\n";
}

composer 

php vendor/bin/siam-docs tests [要扫描的目录名]