linkxtr / laravel-qrcode
A clean, modern, and easy-to-use QR code generator for Laravel
Requires
- php: ^8.2
- bacon/bacon-qr-code: ^3.0
- illuminate/contracts: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
Requires (Dev)
- chillerlan/php-qrcode: ^6.0
- ergebnis/composer-normalize: ^2.54
- laravel/pao: ^1.1
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.0 || ^4.0
- pestphp/pest-plugin-laravel: ^3.0 || ^4.0
- pestphp/pest-plugin-type-coverage: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^1.0 || ^2.0
- spatie/invade: ^2.1
Suggests
- ext-gd: Required to generate PNG and WebP images via GD
- ext-imagick: Required to generate PNG and WebP images via Imagick
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-25 13:14:56 UTC
README
linkxtr/laravel-qrcode is the actively maintained, modern QR code generator engineered specifically for Laravel 12 & 13 (and PHP 8.2β8.6). Built on the vector-native bacon/bacon-qr-code v3 engine, it pairs clean Laravel ergonomics with uncompromising engineering rigorβbacked by an automated test suite that decodes and validates every generated QR code to prove real-world scannability.
π Read the Full Documentation
π¨ Visual Showcase Gallery
Every QR code below was generated directly by linkxtr/laravel-qrcode. The test suite decodes generated output back to its original payload on every CI run, so "it scans" is an assertion, not a hope.
| Style | Scannable Preview | 3-Line Fluent Snippet |
|---|---|---|
| 1. Classic Brand Color Crisp brand foreground |
|
|
| 2. Dot Modules + Circle Eyes Modern rounded aesthetic |
|
|
| 3. Diagonal Gradient Vibrant two-tone transition |
|
|
| 4. Multi-Color Custom Eyes Distinct corner branding |
|
|
| 5. Center Logo Merge Embedded logo with high EC |
|
merge()expects a raster logo β point it at a PNG (or JPEG) that exists in your application;public_path('images/logo.png')is illustrative. An SVG logo throwsImageMergeException: Invalid image provided for mergewhen the output format is SVG, which is the default. KeeperrorCorrection('H')so the payload survives the overlay.
βοΈ Why linkxtr/laravel-qrcode?
| Feature | linkxtr/laravel-qrcode |
simplesoftwareio/simple-qrcode |
Raw endroid/qr-code |
|---|---|---|---|
| Active Maintenance | β Actively Maintained (v3.4.0, Oct 2026) | β οΈ No release since Feb 2021 | β Active generic library |
| Laravel Compatibility | β Tested on Laravel 12 & 13 (CI matrix) | β οΈ No declared Laravel constraint; no CI | β οΈ Requires manual wiring |
| PHP Support | β PHP 8.2 β 8.6 (CI matrix) | β οΈ >=7.2 | ^8.0, no CI matrix |
β οΈ Varies by version (latest 6.x needs 8.5) |
| Underlying Engine | bacon/bacon-qr-code ^3 |
bacon/bacon-qr-code ^2 |
bacon/bacon-qr-code ^3 + GD-based writer |
| Immutable Fluent Builder | β Cloned instances (no leak) | β Mutable state leakage | β οΈ Partial builder pattern |
| Laravel Facade | β
QrCode::... (Drop-in familiar) |
β Legacy facade | β None |
| Native Blade Component | β
<x-qr-code /> with accessible SVG |
β None | β None |
| Artisan CLI Generator | β
php artisan qr:generate |
β None | β None |
| Laravel Cache Integration | β
Built-in (cache(), TTL, stores) |
β None | β None |
| Rich Data Types | β 12 built-in payloads | β οΈ 6 basic payloads | β None built-in |
| Automated Scannability | β Every QR code decoded in CI | β None | β None |
| Quality & Coverage | β 100% Coverage & PHPStan Max | β No static analysis or test matrix | β οΈ Variable |
Coming from
simple-qrcode? The fluent surface will feel familiar (QrCode::size()->generate()), but v3 does not ship a compatibility layer, so a handful of method names differ. The migration guide walks through each difference β it takes about ten minutes.Comparison data verified against Packagist on 2026-11-05.
β‘ Quickstart
Install the package via Composer:
composer require linkxtr/laravel-qrcode
Optionally publish the configuration file:
php artisan vendor:publish --tag=qrcode-config
π οΈ Usage
1. The Fluent Facade
use Linkxtr\QrCode\Facades\QrCode; $qr = QrCode::size(400) ->format('svg') ->color(30, 64, 175) ->errorCorrection('H') ->merge(public_path('logo.png'), 0.25) ->generate('https://example.com');
2. The Blade Component
Drop accessible QR codes directly into Blade views with zero PHP logic:
<x-qr-code data="https://example.com" size="300" color="#1E40AF" margin="2" />
The component automatically renders compliant SVG markup, inherits default settings from config/qrcode.php, and applies accessibility attributes (role="img", aria-label).
3. Interactive Artisan CLI
Generate QR codes straight from your terminal with interactive prompts:
php artisan qr:generate
Or pass flags directly:
php artisan qr:generate "https://example.com" --output="public/qr.svg" --format=svg --size=400
4. High-Performance Caching
Cache expensive QR code rendering seamlessly using Laravel's cache manager:
// Cache for the configured default TTL QrCode::size(400)->cache()->generate('https://example.com'); // Cache for a custom TTL (in seconds) or DateInterval QrCode::size(400)->cache(3600)->generate('https://example.com');
5. Rich Data Types
Built-in helpers format payloads according to international standards:
// Wi-Fi network configuration QrCode::WiFi([ 'ssid' => 'OfficeNetwork', 'encryption' => 'WPA2', 'password' => 'secret-key', ]); // Contact card (vCard / MeCard) QrCode::VCard( name: 'Omar Fathy', phone: '+1234567890', email: 'omar@example.com', company: 'ApricotCake', ); // Cryptocurrency payment QrCode::BTC('bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh', 0.005); QrCode::Ethereum('0x71C7656EC7ab88b098defB751B7401B5f6d8976F', 0.5); // Direct messaging & communication QrCode::Email('hello@example.com', 'Say Hi!'); QrCode::Telegram('username'); QrCode::WhatsApp('1234567890', 'Hello from Laravel!'); QrCode::SMS('1234567890', 'Verification Code');
π Documentation
For full installation guides, advanced customization (radial/diagonal gradients, CMYK color spaces, custom eye shapes), and macro registration, visit the official documentation:
π laravel-qrcode.mintlify.app
π Upgrading to V3
If you are upgrading from simplesoftwareio/simple-qrcode or linkxtr/laravel-qrcode v1.x/v2.x, please refer to our Upgrade Guide for breaking changes and migration steps.
π License
The MIT License (MIT). Please see License File for more information.