rdpascua/reporter

An elegant wrapper for JasperStarter using Laravel

Installs: 1 013

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:HTML

dev-main 2023-08-31 06:43 UTC

This package is auto-updated.

Last update: 2024-04-30 00:29:23 UTC


README

An elegant wrapper for JasperStarter using Laravel

Installation

composer require rdpascua/reporter

Usage

Loading a report and streaming it to the browser

use Rdpascua\Reporter\Facades\Reporter;

// Stream the report to the browser
Reporter::load('path/to/jasper/file.jasper')->stream('document.pdf');

Passing parameters

Reporter::load('path/to/jasper/file.jasper', [
    'param1' => 'value1',
    'param2' => 'value2',
])
->stream('document.pdf');

Saving the report to a file

Reporter::load('path/to/jasper/file.jasper', [
    'param1' => 'value1',
    'param2' => 'value2',
])
->save('document.pdf');

Generate a report using a database connection

Reporter::load('path/to/jasper/file.jasper')->withDataSource('pgsql')->save('document.pdf');

Compiling a jrxml file

Reporter::load('path/to/jasper/file.jrxml')->compile('path/to/jasper/file.jasper');

TODO: Compiling multiple jrxml files

Reporter::load([
    'path/to/jasper/file1.jrxml',
    'path/to/jasper/file2.jrxml',
    'path/to/jasper/file3.jrxml',
])->compile();

// Generates the following files
// path/to/jasper/file1.jasper
// path/to/jasper/file2.jasper
// path/to/jasper/file3.jasper

TODO

  • Compiling multiple jrxml files
  • Add support for jdbc connections
  • Add support for csv
  • Add support for xml
  • Add support for json