hgthecode / thinkphp-apidoc Goto Github PK
View Code? Open in Web Editor NEWThinkPHP 注释自动生成API文档,在线调试,代码生成器,Markdown文档
Home Page: https://hgthecode.github.io/thinkphp-apidoc/
License: MIT License
ThinkPHP 注释自动生成API文档,在线调试,代码生成器,Markdown文档
Home Page: https://hgthecode.github.io/thinkphp-apidoc/
License: MIT License
Class "Banner" does not exist
code: -1
file: "/~~~~~~vendor/hg/apidoc/src/ParseAnnotation.php"
line: 28
message: "Class "Banner" does not exist"
name: "ReflectionException"
markdown文档配置docs不支持{:version}么?配置了好像不生效
thinkphp6框架下app同级目录下添加一个插件目录addon的话,那么配置好前端页面和config下的apidoc.php后,访问:thinkphp6框架下app同级目录下添加一个插件目录addon的话,没有打开预期页面,而是会跳转到addon目录里面去,报错如下:控制器不存在:addon\apidoc\controller\Index
比如说,我的控制器有很多方法,有什么办法可以不用每个方法都加上
@apidoc\Header("Authorization", require=true, desc="Token")
多应用多域名,要怎么设置呢
多版本是怎么配置的?
protected function autoCreateUrl($method): string
{
$isAuto = Config::get('controller_auto_search')||in_array('controller_auto_search',$this->config);
$pathArr = [];
if ($isAuto){
$pathArr = explode("\\", $method->class );
}else{
$searchString = $this->controller_layer . '\\';
$substr = substr(strstr($method->class, $searchString), strlen($searchString));
$pathArr = explode("\\", str_replace($substr, str_replace('\\', '.', $substr), $method->class));
}
// 控制器地址
$filterPathNames = array("app", $this->controller_layer);
$classPathArr = [];
foreach ($pathArr as $item) {
if (!in_array($item, $filterPathNames)) {
$classPathArr[] = $item;
}
}
$classPath = implode('/', $classPathArr);
return '/' . strtolower($classPath) . '/' . $method->name;
}
文件目录:
application配置文件:config/apidoc.php
apps 配置
'apps' => [
['title'=>'API 接口','path'=>'app\maintain\home\api','folder'=>'api'],
]
User.php 命名空间:app\maintain\home\api;
User.php 内容:
/**
* @Apidoc\Title("基础的注释方法")
* @Apidoc\Desc("最基础的接口注释写法")
* @Apidoc\Method("GET")
* @Apidoc\Author("HG-CODE")
* @Apidoc\Tag("测试")
* @Apidoc\Param("username", type="abc",require=true, desc="用户名")
* @Apidoc\Param("password", type="string",require=true, desc="密码")
* @Apidoc\Param("phone", type="string",require=true, desc="手机号")
* @Apidoc\Param("sex", type="int",default="1",desc="性别" )
* @Apidoc\Returned("id", type="int", desc="用户id")
*/
public function login()
{}
api 请求地址: http:// host /maintain/api.user/login
请问如何配置,目前配置没有API列表
如题,谢谢!
不支持PHP8
有没有配置是可以开关整个文档
用After(event="setGlobalParam")事件设置一个全局参数并赋值,当请求参数类型为formdata时,调试其他接口,全局参数没有值,使用默认请求类型时有值。
API接口地址: /shop/user.User/getChildren
访问时的路径: host/index.php/shop/shop/user.User/getChildren
正确的地址: host/index.php/shop/user.User/getChildren
这里多了一个 shop
请问如何配置
apidoc.php中的apps如下配置
[ 'title' => 'shop端', 'path' => 'app\shop\controller', 'folder' => 'shop', 'groups' => [ ['title' => '基础模块', 'name' => 'base'], ['title' => '功能模块', 'name' => 'function'], ], ]
前端 config.js
HOSTS: [ { title: "shop", host: "http://test.com" }, ],
看见访问api目前只是密码效验,这个固定的密码不安全吧,抓包一下获取就完了,应该用token效验,
多应用模式下自动生成的url总是会附带app字符,导致访问地址不正确,建议增加个配置,可以去掉自动附带app。
例如 host/nm/comm/index.php 自动生成的url为 host/app/nm/comm/index.php
在实际开发中,基本上url都是不需要重新定义的,期望自动生成时也能正确。
如题,有时候同一个模块功能,方法都写在同一个控制器里,可是该模块下,有多个子模块,想要进行继续分组, ,好像除了新建多一个控制器之外,没办法实现了,.有一些旧的控制器,想要补充注释 ,新增加文档,变得很难,,因为已经写在一个控制器里面了,除非要前后端改动,,,获取新方法
composer require hg/apidoc 安装不了提示没有包是为什么
父类方法生成url的bug。我直接传$refClass autoCreateUrl($refClass,$method)解决url生成bug
接口层分组不起作用?另外DELETE请求 样式有点问题。描述文字被遮住了。
建议增加8.0版本支持
重新安装了,api页面显示正常,后台配置信息前台也能正常显示和使用,控制器注释按照格式写的,但是api页面就是不显示API列表,左侧空白
左侧分组显示不正常,漏写全部
翻了几遍文档,没看到如何支持restful格式的接口,@apidoc\Param只能用query来接收
例如:application/x-www-form-urlencoded
如题,ooxx_aaa_vvv
[ 'title'=>'xxxxx子系统', 'folder'=>'ooxx_aaa_vvv', 'items'=>[ ['title'=>'V1.0','path'=>'app\ooxx_aaa_vvv\controller\v1','folder'=>'v1'], ['title'=>'V2.0','path'=>'app\ooxx_aaa_vvv\controller\v2','folder'=>'v2'] ] ],
版本切换时会有问题 读不到配置
希望 Mock调试数据,能增加手机号、身份证号自动生成规则,更加方便调试。谢谢
如题:请问有没有支持可以下载导出接口文档的功能,,这样的话,就可以直接下载给对外的人了, 或者类似swagger那种,导出文件可以离线看
[Semantical Error] The annotation "@catalog" in method app\api\controller\appdesigner\Order::add() was never imported. Did you maybe forget to add a "use" statement for this annotation?
调试中字段如果为文件类型可以加入上传文件功能来方便调试吗?
现在只能根据控制器分组,能不能一个控制器在不分控制器的前提的下对不同api进行分组
在thinkphp中使用确实很不错!
作者可否有计划兼容webman框架呢?
composer require hg/apidoc 执行后,没有生成config.php,导致http://www.mytt.com/apidoc/config 404
你好,参照文档[从0创建TP6新项目与Apidoc的安装]步骤,thinkphp为6.0.9版本,这个问题如何处理
我用的TP6,入口文件在项目根目录,不在public下。按照文档安装配置apidoc后一直报错:控制器不存在:app\controller\Config
按照常见问题里提供的方法配置之后也还是报这个错。
我分别尝试把前端页面apidoc目录放在项目根目录下、放到public目录下都报上述错误。
该如何处理呢?
我使用tp6的注解路由分组 @group后,下面方法@Api\Url里填的路径,一到文档前端就会自动加上Group的名字,在我业务的多应用模式下老是导致路径问题,请问有什么办法忽略掉某些注释嘛
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.