cognetif / report-generator
此包已被废弃,不再维护。未建议替代包。
报告生成器 - 生成 Excel、CSV、HTML 报告
v1.2.0
2021-04-15 14:47 UTC
Requires
- php: ^8.0
- phpoffice/phpspreadsheet: ^1.10
Requires (Dev)
- ext-fileinfo: *
- illuminate/support: ^6.10
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-02-26 14:51:30 UTC
README
此库允许您轻松创建 XLSX、CSV 或 HTML 格式的报告。
安装
使用 composer 安装
$ compose require cognetif/report-generator
使用方法
- 创建或扩展
Cognetif\ReportGenerator\Report
。 Report::setHeaders($headers = [])
函数用于设置报告头。Report::addDataLine($line = [])
函数用于向报告体添加单行数据。Report::addDataSet($dataSet = [])
函数用于将整个数据集添加到体中。- 使用
Report::makeCsv()
或Report::makeHtml()
或Report::makeExcel()
函数来控制输出类型。 - 使用
Report::generate()
构建并返回报告。 - 使用
Report::clear()
清除报告中的体数据集。标题保持不变。 - 使用
Report::setMaxMbMemory(int $mb = 5)
设置用于生成 CSV 报告的最大兆字节数(默认:5MB)。 - 使用
Report::getDataSet()
获取整个数据集作为数组。无标题。 - 使用
Report::maxDataColumns()
获取数据集行中列数最多的整个列数。
许可证
此库受 MIT 许可证的版权保护。请阅读 许可证条款。
问题 / 贡献
欢迎并鼓励贡献。此库是开源的,但由 Cognetif.com 维护。请在以下地址免费提出问题: https://gitlab.com/cognetif-os/report-generator