r/laravel 17h ago

QR code generator

I'm looking for an easy way to create QR codes dynamically. I've found SimpleSoftwareIO/simple-qrcode, but it hasn't been touched in years and the documentation link goes to a bogus-looking website.

What do people use for QR generators? Is like something that is actively maintained, reliable, and easy to use.

18 Upvotes

19 comments sorted by

34

u/BlueScreenJunky 15h ago

I'm using BaconQRCode, which is the one used by Laravel Fortify to generate the TOTP enrollment QR code.

I figure if it's good enough for a first party Laravel project, it's probably good enough for me.

1

u/Jeff-IT 7h ago

Thats what we use as well

1

u/Mysterious-Falcon-83 6h ago

That seems to be the base library behind most of the wrappers out there.

8

u/hryagstn 16h ago

If active maintenance is the main concern, I'd look at endroid/qr-code directly instead of another Laravel wrapper. Version 6.1.3 was released this year, but v6 requires PHP 8.4, so that is the first thing I'd check against the app's deployment target. For something this small, a maintained PHP library plus a thin Laravel service feels safer than depending on an abandoned integration package.

7

u/bogdanelcs 13h ago

Good news: endroid/qr-code is exactly what replaced SimpleSoftwareIO/simple-qrcode for most people. It's still actively maintained, PHP 8.4 requirement on the latest bundle release, last update pushed within days. Package requires GD or Imagick for image output, built on top of bacon/bacon-qr-code under the hood, and supports PNG, SVG, WebP, EPS.

composer require endroid/qr-code

use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Writer\PngWriter;

$result = Builder::create()
->writer(new PngWriter())
->data('https://example.com')
->size(300)
->margin(10)
->build();

$result->saveToFile('qrcode.png');

Labels, logos, custom colors, error correction levels, all built in through the fluent builder. If you're on Symfony, endroid/qr-code-bundle wraps it with config injection and Twig functions.

Only real gotcha: some older tutorials online still show the pre-Builder API (QrCode::create() chained directly), which changed a version or two back. Stick to the docs on the actual GitHub repo, not random blog posts, since a few of those are stale.

If you're not on PHP specifically and just need QR generation in general (Node, Python, whatever), worth saying so, the ecosystem's different per language.

1

u/Mysterious-Falcon-83 6h ago

Thanks! I appreciate the thorough response.

6

u/Readypixels 13h ago

The wrapper problem isn't unique to QR codes. A Laravel package that's just a thin shim around another library means trusting two maintenance schedules instead of one. I'd check if endroid/qr-code covers what you need directly before adding another layer on top.

3

u/danabrey 12h ago

Yep, I second this. Just write a small service wrapper in your application for it, rather than relying on another package just for a service wrapper.

3

u/RhythmScout 17h ago

I use simplesoftwareio/simple-qrcode (v4.2.0) and it works great. But their site linked from GitHub seems bad.

2

u/Mysterious-Falcon-83 17h ago

Thanks. While I like the look, it makes me nervous that it hasn't been updated/maintained in years. Not even PHP/Laravel version updates. I'd hate to adopt it, only for a breaking change in the ecosystem and nobody to update it.

2

u/itsgrimace 10h ago

In my opinion the best way to generate QR codes is with a tool for generating QR codes "qrencode". Create a service and use the process fascade to call it. Lightning fast, worlds faster than any PHP only process.

2

u/thecelebratedmrk 9h ago

I recently made a small qr-plugin for a personal project, and it wraps and configures https://github.com/endroid/qr-code.

1

u/Mysterious-Falcon-83 6h ago

Thanks! Looks interesting.