Error when using PHPJasper: Class 'PHPJasper \ PHPJasper' not found in

0

I'm trying to use PHPJasper but it does not find the class. I took an example from the github page even as a test. The code is simple:

<?php
require __DIR__ . '/vendor/autoload.php';

use PHPJasper\PHPJasper;

$input = __DIR__ . '/vendor/geekcom/phpjasper/examples/hello_world.jrxml';   

$jasper = new PHPJasper;
$jasper->compile($input)->execute();

But it is giving error in the line of $ jasper = new PHPJasper;

Fatal error: Class 'PHPJasper\PHPJasper' not found in C:\xampp\htdocs\testepdf\teste2.php on line 8

To install the composer I did normal, I created a composer.json file with the following content:

{
    "require": {
        "geekcom/phpjasper": "1.16"
    }
}

Followed by the command:

composer install

Library phpjasper github: link

Does anyone know why it does not find PHPJasper ???

    
asked by anonymous 05.08.2018 / 17:32

1 answer

0

I was able to resolve it as follows:

Enter the command line in the project folder, run the command:

composer require geekcom/phpjasper

Then:

composer install

The /vendor folder within the project folder should appear along with the composer.json and composer.lock files.

Try to run your teste2.php and check the /examples folder if the hello_world.jasper was created, if it was created, all right, just go to the next step and generate the report.

    
15.10.2018 / 15:46