Welcome Guest, Not a member yet? Register   Sign In
Integrate Jasperclient jrs-rest-php-client in Codeigniter

How can i integrate the PHP Jasperclient jrs-rest-php-client from github (https://github.com/Jaspersoft/jrs-rest-php-client) in Codeigniter?

With this Code I can use the Jasper PHP-Client without codeigniter in the root folder (I have replaced some code lines with XXX):

require_once "autoload.dist.php";
use Jaspersoft\Client\Client;

$c = new Client (XXX)
$controls = array (XXX);
$report = $sc->reportService()->runReport('XXX', 'pdf', null, null, $controls);

XXX(some html stuff)

echo $report;

Now, to use it as helper in codeigniter I have already copied the jrs-rest-php-client and created a helper (jasperclient_helper) class in application\helpers. The Helper Class have the following code:


function jasperclient(){
require_once 'jrs-rest-php-client-master/autoload.dist.php';
use Jaspersoft\Client\Client;

my Controller Class have the following code:

Class jasperreport extends CI_Controller
function pdf()
$c = new Client(XXX);
$controls = array(XXX);
$report = $sc->reportService()->runReport('XXX', 'pdf', null, null, $controls);
$data["report"] = $report;
$this->load->view('jasperreport_view', $data);

When I want to use it as helper i get a parse error:
syntax error unexpected 'use' (T_USE) in C:\...\application\helpers\jasperclient_helper.php on line 10

line 10 have the following code: "use Jaspersoft\Client\Client;"

Can somebody help me?

You can't use the "use" keyword inside a function.

Theme © iAndrew 2016 - Forum software by © MyBB