picqer / php-barcode-generator

Barcode generator in PHP that is easy to use, non-bloated and framework independent.
GNU Lesser General Public License v3.0
1.67k stars 402 forks source link

Fatal error: Uncaught Error: Class 'Picqer\Barcode\Exceptions\BarcodeException' not found #65

Closed Djenkodz closed 5 years ago

Djenkodz commented 6 years ago

Hey, im trying to use your script and am in a dead end so this my problem i did include all the files and i tried a small exemple and am having this fatal error:

Fatal error: Uncaught Error: Class 'Picqer\Barcode\Exceptions\BarcodeException' not found in /home/siveccd1/public_html/visiteurs/include/src/BarcodeGeneratorPNG.php:44 Stack trace: #0 /home/siveccd1/public_html/visiteurs/tes.php(10): Picqer\Barcode\BarcodeGeneratorPNG->getBarcode('081231723897', 'C128') #1 {main} thrown in /home/siveccd1/public_html/visiteurs/include/src/BarcodeGeneratorPNG.php on line 44

my code is :

<?php
include('include/src/BarcodeGenerator.php');
include('include/src/BarcodeGeneratorPNG.php');
include('include/src/BarcodeGeneratorSVG.php');
include('include/src/BarcodeGeneratorJPG.php');
include('include/src/BarcodeGeneratorHTML.php');

$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();

echo '<img src="data:image/png;base64,' . base64_encode($generator->getBarcode('081231723897', $generator::TYPE_CODE_128)) . '">';

i really need your help

ashickur-rahman commented 6 years ago

Add your 'autoload.php' file from vendor directory. Like require_once __DIR__.'/vendor/autoload.php';

Djenkodz commented 6 years ago

the problem is i don't have neither a vendor directory or a autoload.php

alec-w commented 6 years ago

In that case you will need to include all the files in src/Exceptions too. If you install using composer then you can just include the generated autoload file and this problem would go away (you will likely encounter similar issues with other libraries).