PHPackages                             linkxtr/laravel-qrcode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. linkxtr/laravel-qrcode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

linkxtr/laravel-qrcode
======================

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

v2.3.0(2mo ago)295.1k↑81.7%[1 PRs](https://github.com/Linkxtr/laravel-qrcode/pulls)MITPHPPHP ^8.2CI passing

Since Oct 6Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/Linkxtr/laravel-qrcode)[ Packagist](https://packagist.org/packages/linkxtr/laravel-qrcode)[ RSS](/packages/linkxtr-laravel-qrcode/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (21)Versions (10)Used By (0)

Laravel QR Code Generator
=========================

[](#laravel-qr-code-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/07cc326163b1fee8f5f8fb9be101429a55ea8554c1ea6c786aa86d932744c5d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c696e6b7874722f6c61726176656c2d7172636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/linkxtr/laravel-qrcode)[![Total Downloads](https://camo.githubusercontent.com/3a879a8f7ecfed85dc96bece045e6feb87cd1f4ba207c9c7b4355f06e6e17abf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c696e6b7874722f6c61726176656c2d7172636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/linkxtr/laravel-qrcode)[![PHP Version](https://camo.githubusercontent.com/986a82879e8e04d07341d7af1f552199264b62ae09d119845b5adebb364de709/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c696e6b7874722f6c61726176656c2d7172636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/linkxtr/laravel-qrcode)[![License](https://camo.githubusercontent.com/2f135b9b93a7eae058b00b1480ed7e03914cb9aa7781c12a7c39cddf69eae525/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c696e6b7874722f6c61726176656c2d7172636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/linkxtr/laravel-qrcode)

A simple and easy-to-use QR Code generator for Laravel, based on the `bacon/bacon-qr-code` library.

**Note:** This is version `2.x`.

- **Version 2.x** is the current stable release, requiring PHP 8.2+ and Laravel 11+.
- **Version 1.x** is the LTS/Maintenance version. If you need **Laravel 10** support or PHP 8.1, please use [version 1.x](https://github.com/Linkxtr/laravel-qrcode/tree/1.x).
- Version 2.x drops compatibility with `simplesoftwareio/simple-qrcode` to provide a more streamlined API.
- 📚 **Upgrading?** Check out the [Upgrade Guide](docs/UPGRADE-2.0.md).

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.0 or higher
- `ext-imagick` extension (optional, but recommended for better performance). If `imagick` is not available, the package will automatically fallback to using `gd` for PNG and WebP generation.

📦 Installation
--------------

[](#-installation)

```
composer require linkxtr/laravel-qrcode
```

The package uses Laravel's package auto-discovery, so the service provider and facade are registered automatically.

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage in Blade Templates

[](#basic-usage-in-blade-templates)

The `` component is automatically available after installation.

```

```

### In Controllers

[](#in-controllers)

```
use Linkxtr\LaravelQrCode\Facades\QrCode;

public function generate()
{
    // Return as SVG response
    return QrCode::generate('QR Code Content');

    // Or save to file
    QrCode::generate('Content', storage_path('app/qrcodes/qr.svg'));

    // Or get as string
    $svg = QrCode::generate('Content');
}
```

✨ Features
----------

[](#-features)

### 🎨 Enhanced Customization

[](#-enhanced-customization)

```
// Colors and styling
QrCode::size(300)
    ->color(255, 0, 0)
    ->backgroundColor(255, 255, 255)
    ->style('dot')
    ->eye('circle')
    ->generate('Styled QR Code');

// Error correction
QrCode::errorCorrection('H')->generate('Important Data');

// Merge images
QrCode::merge('path/to/logo.png')->generate('With Logo');
```

### 📱 Multiple Data Types

[](#-multiple-data-types)

```
// URLs
QrCode::generate('https://example.com');

// Emails
QrCode::email('to@example.com', 'Subject', 'Body');

// Phone numbers
QrCode::phoneNumber('+1234567890');

// SMS
QrCode::SMS('+1234567890', 'Message body');

// WiFi
QrCode::wiFi([
    'ssid' => 'Network',
    'encryption' => 'WPA', // Supported: WEP, WPA, WPA2, nopass
    'password' => 'Password'
]);

// Geolocation
QrCode::geo(37.7749, -122.4194);

// BTC
QrCode::btc(['btcaddress', 0.0034, ['label' => 'label', 'message' => 'message', 'returnAddress' => 'https://www.returnaddress.com']]);

// Ethereum (amount in ETH)
QrCode::ethereum('0x742d35Cc6634C0532925a3b8D2b2CE1e5bfb043d', 1.5);
// vCard
QrCode::vCard([
    'name' => 'John Doe',
    'first_name' => 'John',
    'last_name' => 'Doe',
    'email' => 'john@example.com',
    'phone' => '+1234567890',
    'company' => 'Tech Corp',
    'title' => 'Developer',
    'url' => 'https://example.com'
]);

// Calendar Event
use Carbon\Carbon;

QrCode::calendar([
    'summary' => 'Laracon US',
    'description' => 'The official Laravel conference.',
    'location' => 'New York, NY',
    'start' => Carbon::create(2024, 8, 27, 9, 0, 0),
    'end' => Carbon::create(2024, 8, 28, 17, 0, 0),
]);

// WhatsApp
QrCode::WhatsApp(['number' => '+1234567890', 'message' => 'Hello from Laravel!']);

// Telegram
QrCode::telegram('username');
```

🔧 Advanced Usage
----------------

[](#-advanced-usage)

### All Available Methods

[](#all-available-methods)

```
// Size and format
QrCode::size(250)->format('png')->generate('Content');

// Colors with RGB
QrCode::color(255, 0, 0)->generate('Red QR');

// Background color
QrCode::backgroundColor(255, 255, 0)->generate('Yellow background');

// Margin
QrCode::margin(2)->generate('With margin');

// Encoding
QrCode::encoding('UTF-8')->generate('Unicode content');

// Gradient colors
QrCode::gradient(0, 0, 255, 255, 0, 0, 'vertical')->generate('Gradient');
```

### Error Correction Levels

[](#error-correction-levels)

- `L` - 7% of data bytes can be restored
- `M` - 15% of data bytes can be restored
- `Q` - 25% of data bytes can be restored
- `H` - 30% of data bytes can be restored (default)

```
QrCode::errorCorrection('H')->generate('High error correction');
```

### Image Merging

[](#image-merging)

Image merging is supported for PNG, WebP, and SVG formats.

```
// Merge with logo
QrCode::format('png')->merge('path/to/logo.png', 0.3, true)->generate('With Logo');

// Merge with SVG
QrCode::format('svg')->merge('path/to/logo.png', 0.3, true)->generate('With Logo');
```

**Note:** Image merge is not supported for EPS format.

💡 Common Examples
-----------------

[](#-common-examples)

### Generate QR for Website

[](#generate-qr-for-website)

```
QrCode::size(200)
    ->generate('https://your-website.com');
```

### QR Code with Logo

[](#qr-code-with-logo)

```
QrCode::size(300)
    ->merge(public_path('logo.png'), 0.3, true)
    ->generate('QR with logo');
```

### Colorful QR Code

[](#colorful-qr-code)

```
QrCode::size(300)
    ->color(58, 94, 255)
    ->backgroundColor(255, 255, 255)
    ->generate('Colorful QR');
```

### WiFi QR Code

[](#wifi-qr-code)

```
QrCode::wiFi([
    'ssid' => 'MyWiFi',
    'encryption' => 'WPA', // Supported: WEP, WPA, WPA2, nopass
    'password' => 'my-password'
]);
```

> **Warning:** WEP encryption is deprecated and insecure. It is supported only for legacy compatibility. It is strongly recommended to use WPA or WPA2 instead.

### Styled QR Code

[](#styled-qr-code)

```
QrCode::size(250)
    ->color(255, 0, 0)
    ->style('dot')
    ->eye('circle')
    ->margin(1)
    ->generate('Styled QR Code');
```

🤝 Contributing &amp; 🗺️ Roadmap
-------------------------------

[](#-contributing--️-roadmap)

### Version 2 Roadmap

[](#version-2-roadmap)

We're actively working on Version 2 with these planned features:

- vCard data type
- Calendar event data type
- WebP format support
- Telegram data type support
- WhatsApp data type support
- Animated QR codes
- Bitcoin payment QR codes
- Extended customization options

### Contributing

[](#contributing)

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

### Request Features

[](#request-features)

Have an idea? [Open an issue](https://github.com/linkxtr/laravel-qrcode/issues) with your feature request!

🐛 Troubleshooting
-----------------

[](#-troubleshooting)

### Common Issues

[](#common-issues)

**QR code not displaying in blade:**

When using the facade directly, make sure to use unescaped output:

```
{!! QrCode::generate('Content') !!}  ✅
{{ QrCode::generate('Content') }}     ❌
```

Alternatively, use the much simpler Blade component:

```
 ✅
```

**File permission errors:**

```
// Ensure directory exists and is writable
QrCode::generate('Content', storage_path('app/qrcodes/qr.svg'));
```

**Large QR codes:**

```
// For large content, use higher error correction
QrCode::size(400)
    ->errorCorrection('H')
    ->generate('Very long content...');
```

📚 API Reference
---------------

[](#-api-reference)

### Core Methods

[](#core-methods)

- `generate($text, $filename = null)` - Generate QR code
- `size($size)` - Set size in pixels
- `color($red, $green, $blue, $alpha = null)` - Set QR color (alpha 0-127)
- `backgroundColor($red, $green, $blue, $alpha = null)` - Set background color (alpha 0-127)
- `style($style)` - Set style (dot, square, round)
- `eye($style)` - Set eye style (circle, square)
- `gradient($startRed, $startGreen, $startBlue, $endRed, $endGreen, $endBlue, $type)` - Set gradient color
- `format($format)` - Set format (svg, png, eps, webp)
- `margin($margin)` - Set margin size
- `errorCorrection($level)` - Set error correction level (L, M, Q, H)
- `encoding($encoding)` - Set character encoding
- `merge($image, $percentage, $absolute)` - Merge image/logo

### Data Type Methods

[](#data-type-methods)

- `email($to, $subject, $body)` - Generate email QR
- `phoneNumber($phone)` - Generate phone QR
- `SMS($phone, $message)` - Generate SMS QR
- `geo($lat, $lng)` - Generate location QR
- `wiFi($config)` - Generate WiFi QR
- `btc($config)` - Generate BTC QR
- `ethereum($address, $amount = null)` - Generate Ethereum QR (amount in ETH)
- `vCard($config)` - Generate vCard QR
- `calendar($config)` - Generate Calendar Event QR
- `WhatsApp($params)` - Generate WhatsApp QR (array with `number` and optional `message`)
- `telegram($username)` - Generate Telegram QR

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Based on the original work by [`simplesoftwareio/simple-qrcode`](https://github.com/simplesoftwareio/simple-qrcode)
- Built upon [`bacon/bacon-qr-code`](https://github.com/Bacon/BaconQrCode)
- Maintained by [khaled-sadek](https://github.com/khaled-sadek) and [contributors](../../contributors)

---

**Need help?** [Open an issue](https://github.com/linkxtr/laravel-qrcode/issues) • **Found a bug?** [Report it](https://github.com/linkxtr/laravel-qrcode/issues)

*⭐ If you find this repository useful, please consider starring it.*

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~8 days

Total

9

Last Release

61d ago

Major Versions

1.x-dev → v2.0.02025-12-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/752039d07be9572ead812ee59ad26ba617d48a481d56de3f95b77f68ce2e7651?d=identicon)[khaled-sadek](/maintainers/khaled-sadek)

---

Top Contributors

[![khaled-sadek](https://avatars.githubusercontent.com/u/65240054?v=4)](https://github.com/khaled-sadek "khaled-sadek (76 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (2 commits)")

---

Tags

qrcodeqrlaravelgeneratorbacon

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/linkxtr-laravel-qrcode/health.svg)

```
[![Health](https://phpackages.com/badges/linkxtr-laravel-qrcode/health.svg)](https://phpackages.com/packages/linkxtr-laravel-qrcode)
```

###  Alternatives

[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M92](/packages/simplesoftwareio-simple-qrcode)[akira/laravel-qrcode

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

431.4k](/packages/akira-laravel-qrcode)[devtical/nova-qrcode-field

Nova QR code field

4560.6k2](/packages/devtical-nova-qrcode-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
