endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.45k stars 726 forks source link

Fatal error: Class 'Endroid\QrCode\Builder\Builder' not found i #349

Closed abzal0 closed 3 years ago

abzal0 commented 3 years ago

Installed using composer. Shows the error that class Builder not found.

require "vendor/autoload.php";

use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;

$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data('https://test.com')
->encoding(new Encoding('UTF-8'))
->size(200)
->margin(10)
->roundBlockSizeMode(new RoundBlockSizeModeMargin())
->logoPath('logo.png')
->labelText('SCAN ME')
->build();

return $result->getDataUri();

Folder structure:

qr.php - runs the code above vendor composer.json composer.lock logo.png

Any suggestions would be helpful.

endroid commented 3 years ago

Hi @abzal0 the class exists at that location as you can see here https://github.com/endroid/qr-code/blob/master/src/Builder/Builder.php so my best guess is either your autoloader is looking in the wrong location or something went wrong during installation, resulting in missing files. Another guess would be that you installed an older version which does not have this class. Good luck!