willpower232/cloverparser-laravel
Composer 安装命令:
composer require willpower232/cloverparser-laravel
包简介
A Laravel/Lumen wrapper for willpower232/cloverparser to generate an image and store files
README 文档
README
This is a wrapper which takes the percentage coverage generated by willpower232/cloverparser and then gives you the ability to use Laravel to create a coverage badge SVG using a view and store that image somewhere using the storage class.
This is also compatible with Lumen but I haven't figured out how to statically analyse both Lumen and Laravel.
A former casual user of codecov and interested in controlling my own data, I decided to see how complicated it would be to operate a similar setup myself after their uploader script was compromised.
This is the second part of this project, turning the coverage percentage into something displayable and storing that somewhere easily accessible.
Installation
composer require willpower232/cloverparser-laravel
Usage
Set a path to your CloverParser instance and then you can store files. Paths are made up of a project folder and a branch as the base name of the file.
Storing files in a folder per project and with the branch name as the file name should allow the files to be structured in a way that makes sense and also in a way that allows for future use without having to look anything else up. As a branch continues and is tested more often, stale files are replaced so that only the most recent are stored.
If you are looking to create a dataset of coverage over time, you can record the percentages as you wish in your application (or even prefix the clover file names to avoid overwriting them).
use WillPower232\CloverParserLaravel\CloverParser; $urlToSVG = app(CloverParser::class) ->setPath($project, $branch) ->addFile($pathToCloverFile) ->storeImage();
You could also store other files for your future reference.
use WillPower232\CloverParserLaravel\CloverParser; $parser = app(CloverParser::class) ->setPath($project, $branch) ->addFile($pathToCloverFile); $urlToSVG = $parser->storeImage(); $urlToFile = $parser->store("$branch.clover", file_get_contents($pathToCloverFile));
Alternatively, making more use of Laravel
$file = new \Illuminate\Http\File($pathToCloverFile); $parser = app(CloverParser::class) ->setPath($project, $branch) ->addFile($file); $urlToFile = $parser->store("$branch.clover", $file);
or via upload directly
$file = $request->file('file'); $parser = app(CloverParser::class) ->setPath($project, $branch) ->addFile($file); $urlToFile = $parser->store("$branch.clover", $file);
Don't forget to validate user uploaded files before hosting them yourself.
Configuration
If you want to store the files in a different disk, you can specify its name in your environment.
CLOVER_PARSER_DISK=s3
willpower232/cloverparser-laravel 适用场景与选型建议
willpower232/cloverparser-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 willpower232/cloverparser-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 willpower232/cloverparser-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-26