| Package Data | |
|---|---|
| Maintainer Username: | deathkel |
| Package Create Date: | 2016-07-21 |
| Package Last Update: | 2018-07-17 |
| Language: | CSS |
| License: | MIT |
| Last Refreshed: | 2025-12-14 15:03:47 |
| Package Statistics | |
|---|---|
| Total Downloads: | 104 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 11 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
用于查看和测试后端REST接口
laravel >= 5.1,php > 7
composer require deathkel/apitest
请到注册服务提供者到Laravel服务提供者列表中。 方法1: 在config/app.php配置文件中,key为'providers'的数组中添加服务提供者
'providers'=>[
//...
Deathkel\Apitest\ApiTestServiceProvider::class
]
运行 'php artisan vendor:publish'将视图文件和静态文件发布到你们的项目中,请确保文件夹resource/views/api和public/api文件夹为空。 否则请自行复制使用本项目frotend文件中的blade和静态文件
请配置在debug模式开启下的路由,不要再生产环境中使用
if (config('app.debug')) {
Route::get('apitest','ApiTestController@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();
.....

@apiTest : apiTest功能标识@param {参数格式} {参数} {简单说明} : 查询参数注意用一个
空格分割
@{任意名称} : 任意注释author version ...注意名称和说明之间用一个
空格分割
/**
* @apiTest
* @param nullable|int name 名称
* @说明 这个是index方法
* @随便啥玩意 随便啥的说明
* 随便啥的说明第二行
* -#-%^&*;a'd--符号啥的也都可以
* @又一个名称
* 又一个名称的注释
* @author kel
* @version 1.0.0
*/
public function index(){
}
The MIT License (MIT). Please see License File for more information.