PHP code example of simitgroup / phpjasperxml

1. Go to this page and download the library: Download simitgroup/phpjasperxml library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

simitgroup / phpjasperxml example snippets


composer 


simitsdk\phpjasperxml\PHPJasperXML;
$filename = __DIR__.'/sample.jrxml';

$data=[ ['user_id'=>0, 'fullname' => 'name1','email'=>'[email protected]','gender'=>'M' ], 
        ['user_id'=>1, 'fullname' => 'name2','email'=>'[email protected]','gender'=>'F' ], 
        ['user_id'=>2, 'fullname' => 'name3','email'=>'[email protected]','gender'=>'M' ], ];

$config = ['driver'=>'array','data'=>$data];

$report = new PHPJasperXML();
$report->load_xml_file($filename)    
    ->setDataSource($config)
    ->export('Pdf');