simplesoftwareio/simple-qrcode
Laravel-friendly QR code generator built on BaconQrCode. Create PNG/SVG QR codes with a fluent API—set size, colors, margins, error correction, merge images, and output inline or save to files for apps, tickets, and more.
Install the package via Composer:
composer require simplesoftwareio/simple-qrcode
In Laravel (≥5.5), service provider and facade auto-discovery are enabled by default. Use the QrCode facade immediately in controllers or Blade views:
use SimpleSoftwareIO\QrCode\Facades\QrCode;
// In a controller or route closure
return QrCode::size(200)->generate('https://example.com');
For Blade: output as raw HTML to render SVG inline:
{!! QrCode::generate('Hello World') !!}
First use case: embed a simple QR code on a product page or ticket — just pass the URL or text to encode.
color(), backgroundColor()) or animating.generate($data, $path) to save PNG/SVG/EGF files (e.g., generate and store ticket QRs in storage/app/qrcodes).embedData() with Mail facade or Mailable to embed QRs inline in emails:
->embedData(QrCode::size(150)->generate($token), 'token_qr.png', 'image/png')
<div class="visible-print">
{!! QrCode::size(80)->generate(request()->url()) !!}
<small>Scan to return</small>
</div>
QrCode::format('png')
->size(300)
->color(0, 51, 102)
->backgroundColor(255, 255, 204)
->style('round')
->eye('circle')
->generate($data, $path);
imagick: If saving PNGs fails, ensure the PHP imagick extension is installed and enabled.{!! !!}: Avoid escaping ({{ }}) — QR output is an HtmlString and escaping breaks SVG/HTML rendering.generate() returns Illuminate\Support\HtmlString in Laravel, not raw string — important if mocking or testing.H) improve robustness but reduce data capacity; use M or L for space-constrained codes.color()/backgroundColor(), alpha isn’t 0–255 — it’s 0 (opaque) to 127 (fully transparent). Use 127 for 50% transparency approx.eyeColor() or style() options only apply meaningfully in SVG format — PNG may ignore fine-grained styling.encoding('UTF-8') for non-Latin text (e.g., Arabic, emojis); default is ISO-8859-1.endroid/qr-code for actively maintained alternatives with broader support (though simple-qrcode remains stable for basic use).QrCode::shouldReceive('generate')->andReturn('<svg>…') in unit tests to avoid QR generation overhead or dependency on GD/Imagick.How can I help you explore Laravel packages today?