Skip to content

Installation

If you're new about Jasper and prefer to evaluate first, just play with Jasperstudio and create one or two reports.

Installation

PHP

$ composer require soluble/jasper

Jasperbridge

There's an open issue about providing a docker install. We ❤ contributors :)

Quick start on Ubuntu Xenial with Tomcat8:

$ sudo apt install sudo apt install default-jdk tomcat8

Build the war container (war is ± a phar for the PHP world)

# Example based on php-java-bridge master
$ git clone https://github.com/belgattitude/php-java-bridge.git
$ cd php-java-bridge
$ ./gradlew war -I init-scripts/init.jasperreports.gradle -I init-scripts/init.mysql.gradle 

Deploy on Tomcat (example on ubuntu sudo apt install tomcat8)

$ sudo cp ./build/libs/JavaBridgeTemplate.war /var/lib/tomcat8/webapps/JasperBridge.war

The the address to http://localhost:8080/JasperBridge, you should see the bridge dashboard page:

Test

Test whether the bridge is working:

<?php declare(strict_types=1);

use Soluble\Japha\Bridge\Adapter;

$ba = new Adapter([
    'driver' => 'Pjb62',
    'servlet_address' => 'localhost:8080/JasperReports/servlet.phpjavabridge'    
]);

// This should print your JVM version
echo $ba->javaClass('java.lang.System')->getProperty('java.version');