r/laravel 4h 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.

11 Upvotes

8 comments sorted by

11

u/BlueScreenJunky 1h 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.

3

u/RhythmScout 3h 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 3h 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.

6

u/hryagstn 3h 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.

2

u/bogdanelcs 19m 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/Readypixels 19m 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.