Help with package in laravel 5

0

I need some help to use this packet ( picqer / php-barcode-generator ) in my project Laravel 5 .

Installation :

composer require picqer/php-barcode-generator

Driver :

use src\BarcodeGeneratorJPG;

Driver :

public function index () {
$cod_bar2 = 'F14157709998995727802010004910F139001000F19620';    
    $generatorPNG = new Picqer\Barcode\BarcodeGeneratorJPG();
        $code = chr(241).$cod_bar2;
        $cod_bar2 = base64_encode( $generatorPNG->getBarcode($code, Picqer\Barcode\BarcodeGeneratorJPG::TYPE_CODE_128_A));
}

The error that laravel generates:

  

"Class 'App \ Http \ Controllers \ Picqer \ Barcode \ BarcodeGeneratorJPG' not   found "

When I change:

$generatorPNG = new Picqer\Barcode\BarcodeGeneratorJPG();

For this:

$generatorPNG = new BarcodeGeneratorJPG();

I get this Error:

  

"Class 'src \ BarcodeGeneratorJPG' not found"

Something tells me that I should configure the file app.php of the folder config but I really do not know what I should do.

    
asked by Andrés 01.03.2018 в 18:00
source

1 answer

0

The problem is that you can not find the class in the route you gave it. The correct route is:

use Picqer\Barcode\BarcodeGeneratorJPG;
    
answered by 02.03.2018 в 08:42