PHP code example of azhai2023 / phpjasperxml

1. Go to this page and download the library: Download azhai2023/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/ */

    

azhai2023 / 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');