Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

geekcom's avatar

[Tip] Create Reports in PHP/Laravel with JasperReports

This package is the solution to compile and process JasperReports (.jrxml & .jasper files) just using PHP.

https://github.com/geekcom/phpjasper

0 likes
7 replies
paulISE's avatar

I have had issues getting this to work with Laravel. Tried using the examples and could compile a report but could not get them to execute. Do you have a working laravel test site that I could clone that has those test cases? thx

paulISE's avatar

Hi:

The error Line 205

I'm getting the "Your report has an error and couldn't be processed try to output the command...

I had sent this as an issue in github before and you had checked out my setup and all the permissions seemed fine.

I've tried installing this on an existing project and a then a clean one and still get the same error. I've tried using both the Laravel version of the instructions and the plain PHP version.

I did notice something that doesn't seem to make sense in the Laravel instructions. The code below doesn't require that the report be compiled first but the plain PHP version does? Also, I get a syntax error due to the comma in the "locale" line. I removed it and got the "Your report has an error"

use JasperPHP\JasperPHP;

Route::get('/reports', function () {

$report = new JasperPHP;

$report->process(
    public_path() . '/report/hello_world.jrxml', //input 
    public_path() . '/report/'.time().'_hello_world', //output
    ['pdf', 'rtf', 'xml'], //formats
    [], //parameters
    [],  //data_source
    '', //locale
    )->execute();

});

I'm able to compile the the hello_world.jrxml into the hello_world.jasper but I can't get it to execute and get the error above.

What would be super helpful is if you have a working laravel project with just the examples that I could clone. That would at help a lot in troubleshooting.

thx

Paul

geekcom's avatar

this problem is because PHPJasper yet not supported in Laravel 5.4

Yagnesh's avatar

where i can get .jrxml file Or how can i create .jrxml ?????

kevinflorenzdaus's avatar
  • I know im abit late in replying to this thread .

You create .jrxml using the JasperSoft Studio . I suggest using the JasperSoft Studio to compil your .jrxml into .jasper

Please or to participate in this conversation.