joaomfrebelo / reports_4_php
用于Rebelo Reports CLI的PHP模块
Requires
- php: 8.0.* || 8.1.* || 8.2.*
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.5.0
- joaomfrebelo/enum: ^3.0.0
- joaomfrebelo/log4php: 3.0.0-BETA2 || ^3.0.0
Requires (Dev)
- phpunit/phpunit: 9.6.3
- smalot/pdfparser: ^v2.1.0
- squizlabs/php_codesniffer: ^3.6.2
This package is auto-updated.
Last update: 2024-09-20 00:02:02 UTC
README
Rebelo Reports for PHP是运行Rebelo Reports的模块。您必须已安装Rebelo Reports CLI。
Rebelo Reports
Rebelo Reports是一个中间件,用于在不能使用嵌入在您的软件中的Jasper Reports Framework或在软件不是Java或存在许可证不兼容性时使用Jasper Reports Framework。
Rebelo Reports项目在:https://github.com/joaomfrebelo/reports_core https://jitpack.io/#joaomfrebelo/reports_core
Rebelo Report CLI项目:https://github.com/joaomfrebelo/reports_cli https://jitpack.io/#joaomfrebelo/reports_cli
将Reports for PHP包含到您的PHP项目中(PHP文件)
通过Composer
$ composer require joaomfrebelo/reports_4_php
Rebelo Reports CLI的java jar文件应从github或jitpack.io编译和安装
PHP使用示例
首先将Config文件夹下的config.properties.example文件重命名为config.properties,然后使用您的选项配置config.properties文件。对于log4php,对logconf.xml.example做同样的处理。
use Rebelo\Reports\Report\Datasource\Database; use Rebelo\Test\Reports\Report\Parameter\Parameter; use Rebelo\Test\Reports\Report\Parameter\Type; use Rebelo\Reports\Report\JasperFile; use Rebelo\Reports\Report\Pdf; $ds = new Database(); $ds->setConnectionString("jdbc:mysql:///sakila"); $ds->setDriver("com.mysql.jdbc.Driver"); $ds->setUser("user"); $ds->setPassword("password"); $parameter = new Parameter(new Type(Type::P_STRING),"parameter name", "parameter value"); $jf = new JasperFile("/path/to/report.jasper", 1); $pdf = new Pdf(); $pdf->setDatasource($ds); $pdf->setJasperFile($jf); $report = new Report(); // Using PChouse reports API $pdfBase64Encoded = $report->invokeApi($pdf); // Using Rebelo reports_cli $pdf->setOutputfile("/path/to/outfile.pdf"); $result = $report->generate($pdf); if($result->getCode() == 0){ // exported ok // pdf is in /path/to/outfile.pdf }else{ // see exitcode // see messages with $result->getMessages(); }
特性
导出到
- 数字签名PDF
- Csv
- Docx
- Html
- Json
- Ods
- Odt
- Pptx
- Rtf
- Text
- Xls
- Xlsx
- Xml
- 打印机
其他
- 使用相同的导出器将多个报告导出为一个。
- 一次导出报告副本,使用复制索引参数。
- 将参数传递给报告,参数类型严格。
- const P_STRING = "string";
- const P_BOOL = "bool";
- const P_BOOLEAN = "boolean";
- const P_DOUBLE = "double";
- const P_FLOAT = "float";
- const P_INTEGER = "integer";
- const P_LONG = "long";
- const P_SHORT = "short";
- const P_BIGDECIMAL = "bigdecimal";
- const P_DATE = "date";
- const P_TIME = "time";
- const P_SQL_TIME = "sqltime";
- const P_SQL_DATE = "sqldate";
- const P_TIMESTAMP = "timestamp";
许可证
版权 (C) 2019 João M F Rebelo
MIT许可证
版权 (c) 2019 João M F Rebelo
特此授予任何获得本软件及其相关文档副本(以下简称“软件”)的人免费使用该软件的权利,不受任何限制,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许向获得软件的人提供副本以供其使用,但需遵守以下条件
上述版权声明和本许可声明应包含在软件的副本或实质部分中。
本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于对适销性、特定用途适用性和非侵权的保证。在任何情况下,作者或版权所有者均不对因使用或不当使用本软件而产生的任何索赔、损害或其他责任承担责任,无论该责任基于合同、侵权或其他法律行为,无论该责任产生于、因之或与此相关。