davidecaruso/jasper-php
Composer 安装命令:
composer require davidecaruso/jasper-php
包简介
PHP library to execute Jasper Reports
README 文档
README
PHP library to generate Jasper Reports.
Install
$ composer require davidecaruso/jasper-php
This automatically installs and provides the Jasper Starter executable and the MySQL Connector Driver. You can also pass to the library's constructor your jasperstarter file's path.
Requirements
- PHP >= 7.0
- Java >= 1.8.0
- Jasper Starter (automatically provided by the Composer installation)
Usage
Compile a jrxml file into a jasper file:
$jasper = new JasperPHP; $jasper->compile('path/to/report.jrxml')->execute();
Generate report via JSON connection:
$jasper = new JasperPHP; $jasper->process( 'path/to/report.jasper', null, ['csv'], [], [ 'driver' => 'json', 'json_query' => 'data', 'data_file' => 'path/to/data.json' ] )->execute();
Example of data.json file:
{
"data": [
{
"first-name": "Foo",
"last-name": "Bar",
"age": 32
},
{
"first-name": "Baz",
"last-name": "Foobar",
"age": 16
}
]
}
Generate report via MySQL connection:
$jasper = new JasperPHP; $jasper->process( 'path/to/report.jasper', false, array('xlsx'), array(), array( 'driver' => 'mysql', 'username' => 'root', 'password' => 'root', 'host' => 'localhost', 'database' => 'mydatabase', 'port' => '3306', ) )->execute();
Use an own executable Jasper Starter file:
$jasper = new JasperPHP('path/to/jasperstarter'); $jasper->compile('path/to/report.jrxml')->execute();
Author
License
Licensed under MIT.
统计信息
- 总下载量: 222
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-05