vulehd/phpreport
Composer 安装命令:
composer require vulehd/phpreport
包简介
PHPReport
关键字:
README 文档
README
PHPReport is a class for building and exporting reports from PHP. It's based on powerful PHPExcel library and includes exporting to popular formats such are HTML, Excel or PDF.
Features
- Simple for using
- Many ways to customize your input data
- Build reports based on predefined templates
- Export to HTML, Excel (xlsx and xls) and PDF
Installation
It's based on PHPExcel, so download it and extract next to PHPReport.php file. To start using it, simply include PHPReport.php in your script and follow the documentation.
Usage and examples
Basicly, there are two way to build a report.
Building it "from scratch"
PHPReport does all the work, your just provide it with your data, like this:
$R=new PHPReport();
$R->load(array(
'id'=>'product',
'data'=>array(
array('Some product',23.99),
array('Other product',5.25),
array('Third product',0.20)
)
)
);
$R->render();
It's great for exporting tabular data. Input data can be further formatted, grouped and customized. See the wiki.
Building it from template
Template is usually some excel file, already formatted and with placeholders for data. There are two types of placeholders: static and dynamic. Static placeholders are, for example, some data like date, city or customer name. Dynamic placeholders are, for example, list of products with variable number of rows.
$R=new PHPReport(array('template'=>'invoice_template.xls'));
$R->load(array(
array(
'id'=>'invoice',
'data'=>array(
'date'=>date('Y-m-d'),
'number'=>'000312',
'customer_id'=>'512',
'expiration_date'=>date('Y-m-d',strtotime('+30day')),
'name'=>'John Doe',
'company'=>'Example, inc',
'address'=>'Some address',
'city'=>'Gotham City',
'zip'=>'0123',
'phone'=>'+123456'
),
'format'=>array(
'date'=>array('datetime'=>'d/m/Y'),
'expiration_date'=>array('datetime'=>'d/m/Y')
)
),
array(
'id'=>'product',
'data'=>array(
array('description'=>'Some product','price'=>23.99,'total'=>23.99),
array('description'=>'Other product','price'=>5.25,'total'=>2.25)
),
'repeat'=>true,
'format'=>array(
'price'=>array('number'=>array('prefix'=>'$','decimals'=>2)),
'total'=>array('number'=>array('prefix'=>'$','decimals'=>2))
)
)
)
);
$R->render();
These reports are great for complex exports like invoices. See the wiki for more examples.
vulehd/phpreport 适用场景与选型建议
vulehd/phpreport 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 40 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 06 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「excel」 「report」 「phpreport」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vulehd/phpreport 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vulehd/phpreport 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vulehd/phpreport 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
Reportico Open Source PHP Report Designer
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
Yii2 export extension
PHP Excel Library
Allow KoolReport to use twig template engine to render view
统计信息
- 总下载量: 40
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL
- 更新时间: 2015-06-17