PHP code example of deathkel / apitest

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

    

deathkel / apitest example snippets


        'providers'=>[
            //...
            Deathkel\Apitest\ApiTestServiceProvider::class
        ]

/**
 * @apiTest
 * @param nullable|int name 名称
 * @说明 这个是index方法
 * @随便啥玩意 随便啥的说明
 * 随便啥的说明第二行
 * -#-%^&*;a'd--符号啥的也都可以
 * @又一个名称
 * 又一个名称的注释
 * @author kel
 * @version 1.0.0
 */
public function index(){

}

    use Deathkel\Apitest\ApiReflection;
    
    class ApiTestController extend Controller{
        public function index(){
            $reflection=new ApiReflection();
            $api=$reflection->getApi();
            $apiToString=json_encode($api);
            
            return view('api.index', ['api' => $api,'apiToString'=>$apiToString]);
        }
    }

    private function config(){
        return [
            'App\Http\Controllers\IndexController',
            'App\Http\Controllers\HomeController',
        ];
    }
    
    .....
    $reflection=new ApiReflection();
    $reflection->setConfig($this->config());
    $api=$reflection->getApi();
    .....