Search by

linkxtr / laravel-qrcode

khaled-sadek

A clean, modern, and easy-to-use QR code generator for Laravel

Package info

github.com/Linkxtr/laravel-qrcode

pkg:composer/linkxtr/laravel-qrcode

Statistics

Installs: 59 212

Dependents: 1

Suggesters: 0

Stars: 43

Open Issues: 0

v3.4.1 2026-11-25 13:06 UTC

README

Latest Version on Packagist Total Downloads PHP Version Laravel Version Tests Code Coverage PHPStan Level Max Scannability: Decode-Verified License

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
Classic Brand QR Code
QrCode::size(300)
->color(30, 64, 175)
->generate('https://linkxtr.com');
2. Dot Modules + Circle Eyes
Modern rounded aesthetic
Dot Modules with Circle Eyes
QrCode::size(300)
->style('dot')->eye('circle')
->color(17, 24, 39)
->generate('https://linkxtr.com');
3. Diagonal Gradient
Vibrant two-tone transition
Diagonal Gradient QR Code
QrCode::size(300)
->gradient([99, 102, 241], [236, 72, 153], 'diagonal')
->eye('circle')
->generate('https://linkxtr.com');
4. Multi-Color Custom Eyes
Distinct corner branding
Multi-Color Custom Eyes
QrCode::size(300)
->color(31, 41, 55)
->eyeColor(0, [239, 68, 68], [153, 27, 27])
->eyeColor(1, [16, 185, 129], [6, 95, 70])
->generate('https://linkxtr.com');
5. Center Logo Merge
Embedded logo with high EC
Center Logo Merge QR Code
QrCode::size(300)
->errorCorrection('H')
->merge(public_path('images/logo.png'), 0.25)
->generate('https://linkxtr.com');

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 throws ImageMergeException: Invalid image provided for merge when the output format is SVG, which is the default. Keep errorCorrection('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.