Qr-Code as image in frontend


I’m looking for a way to display a generated qr-code in the frontend?
Somebody got a sample or a solution please?


Hey folks,

Got it…
Solution: create the endroid qr-code, create a tmp file, and then create a new asset with the tmp file.


If you don’t need to save the result and just display it, you can do this.

Create the QR Code in the controller:

$qrcode = new \Endroid\QrCode\QrCode('Your Message');

Then display it in the view (TWIG):

<img src={{ qrcode.writeDataUri }}>

See endroid info for more options.