您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用swagger-php/ui作API测试

2025/4/30 12:20:07发布7次查看
用swagger-php/ui做api测试
功能:
1 swagger-php根据自定义的规则生成api请求规则,通过phar生成json文件
2 打开swagger-ui/dist/index.html。输入json文件夹目录地址(需要同源),swagger-ui会根据请求的json生成api,页面很漂亮。输入请求参数后执行会获取返回值。
缺点:不能对返回的数据进行验证。功能类似chrome的插件postman。
api action测试参考代码:
resource/postaction.php
项目描述信息
info/api.php
readme
# usage of api docs### raw spec structure* info - general info.* model - entity class* resource - api endpoint### compile api info.* after modify the spec, run shell script, as follows. `cd api-docs` `./gendocumentation.sh`* the compiled content (.json) is stored in documentation/output/### view api docs* visit http://{domain}/documenation/
sh 执行文件
#!/bin/sh../swagger-php/swagger.phar ../output-docs -o ../documentation/output/
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product