承接 julfiker/php-jaspersoft 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

julfiker/php-jaspersoft

Composer 安装命令:

composer require julfiker/php-jaspersoft

包简介

Jasper report base on jaspersoft rest server in to the Laravel or any other php based application.

README 文档

README

Integation jaspersoft REST API to php application to manage report in all format as jasper provided like pdf, docx and xlsx etc. I tried to make it easier to integration with jasper soft.

Install it to the application through composer

composer require julfiker/php-jaspersoft

Laravel specific configuration

1. First add service provider as below in to the config/app
Julfiker\Jasper\JasperReportServiceProvider::class,

2. To publish the config
php artisan vendor:publish --provider="Julfiker\Jasper\JasperReportServiceProvider"

3. Add following and configure jasper server credential in to the .env

#### Jasper server credential configuration #######
JASPER_SERVER_URL=http://127.0.0.1:8888/jasperserver
JASPER_SERVER_USERNAME=jasperadmin
JASPER_SERVER_PASSWORD=jasperadmin  
JASPER_SERVER_REQUEST_TIMEOUT=30

Instruction to use in to the Laravel

1. Using Helper function

/** 
* From controller action
*
* @param $path
* @param string $type  pdf|xlsx|docx
* @param string $name name of the report
* @param array $params its optional, parameter of report in array if required. 
*/
return render_report('{JASPER_REPORT_PATH}', 'pdf', "report_name", ["param" => 123]); 
  

If you want to call from route define just follow as below

Route::get('/testing', function (Redirect $redirect) {
    return render_report('{REPORT_PATH}', 'pdf', 'name_of_the_report');
});

2. Using to generate route and make a link to render a report

echo route('julfiker.jasper.report.render', ['path' => "{report_path}", 'type' => 'pdf', "name" => "{name_of_report}", "param" => 1]);

3. Blade template

<a href="{{route('julfiker.jasper.report.render', ['path' => "{report_path}", 'type' => 'pdf', "name" => "{name_of_report}", "param" => 1])}}">Report</a>
OR
<a href="/jasper/report/render?path={report_path}&type=pdf&name=report_name&p=122">Report</a>

Instruction to use it in other php based application

use Julfiker\Jasper\Manager\JasperReport;

$jasper =  new JasperReport();
$jasper->setServerUrl('jasper_server_url')
       ->setUsername('jasper_user')
       ->setPassword('jasper_password')
       ->make();
     
try {
    $reportContent = $jasper
        ->setPath("{JASPER_REPORT_PATH}")
        ->setType("pdf")
        ->setParams(["param1"=> 1, "param2" => 2])
        ->setRequestTimeout(30)  #30 seconds
        ->generate();
  
  

   //If pdf render
   echo $reportContent;
   header('Content-Type: pdf');
   header('Content-Disposition: inline; filename=report.pdf');
   exit;
   
   //if download in excel file with xlsx
    echo $reportContent;
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment; filename==report.xlsx');
    exit;
    
    //Note: If you response header framework specific where you are working on.
}
catch (\Exception $e) {
    echo $e->getMessage();
}

Any Help?

You can contact me through following access
email: mail.julfiker@gmail.com
skype: eng.jewel
whatsapp: 01817108853

You are welcome to contribute on it further improvement/update or extended usability for all. Just make a pull request.

Thank you

julfiker/php-jaspersoft 适用场景与选型建议

julfiker/php-jaspersoft 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 709 次下载、GitHub Stars 达 8, 最近一次更新时间为 2023 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 julfiker/php-jaspersoft 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 julfiker/php-jaspersoft 我们能提供哪些服务?
定制开发 / 二次开发

基于 julfiker/php-jaspersoft 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 709
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-10