PHPackages                             jamal/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. jamal/laravel-qrcode

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

jamal/laravel-qrcode
====================

Dependency-free Laravel QR Code generator with pure-PHP SVG renderer and optional GD/Imagick PNG.

v1.0.5(today)01↑2900%MITPHPPHP ^8.2

Since Sep 16Pushed todayCompare

[ Source](https://github.com/jamalnasir/laravel-qrcode)[ Packagist](https://packagist.org/packages/jamal/laravel-qrcode)[ RSS](/packages/jamal-laravel-qrcode/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (2)Versions (7)Used By (0)

jamal/laravel-qrcode
====================

[](#jamallaravel-qrcode)

A dependency-free Laravel QR Code generator with a pure-PHP SVG renderer and optional PNG via GD/Imagick.

Standards Compliance
--------------------

[](#standards-compliance)

- Implements ISO/IEC 18004 for **Versions 1–40** (auto-selected from the data length).
- Modes: **Numeric, Alphanumeric, Byte (UTF-8)**.
- Error correction: **L, M, Q, H** via Reed–Solomon over GF(256).
- Masking: evaluates masks **0–7** and selects the lowest-penalty matrix.
- Full function patterns: finder, separators, timing, alignment (v2+), dark module, 15-bit format information (both copies), and 18-bit version information (v7+).
- Output is byte-identical to reference encoders and decodes on standard readers (verified with ZBar across modes, ECC levels, and versions 1–13+).
- Quiet zone default is 4 modules (configurable via `margin`).

Installation
------------

[](#installation)

```
composer require jamal/laravel-qrcode
php artisan vendor:publish --tag=config --provider="Jamal\QrCode\QrCodeServiceProvider"
```

Quick Start
-----------

[](#quick-start)

```
use QrCode;

echo QrCode::text('Hello World')->renderer('svg')->toSvg();
```

Examples
--------

[](#examples)

### 1) SVG and PNG

[](#1-svg-and-png)

```
QrCode::text('Hello')->toSvg();
QrCode::text('Hello')->renderer('gd')->toPng();
```

### 2) Save to file

[](#2-save-to-file)

```
QrCode::text('Save')->renderer('svg')->save(storage_path('app/qr.svg'));
QrCode::text('Save')->renderer('gd')->save(storage_path('app/qr.png'));
```

### 3) Controller Response

[](#3-controller-response)

```
return QrCode::text('Hello')->toSvgResponse();
// or
return QrCode::text('Hello')->renderer('gd')->toPngResponse();
```

### 4) Data URI

[](#4-data-uri)

```
$uri = QrCode::text('Embed')->toDataUri('svg'); // or 'png'
```

### 5) Blade directive

[](#5-blade-directive)

```
@qrcode('https://example.com', ['ecc' => 'Q', 'size' => 256, 'renderer' => 'svg'])
```

### 6) ECC Level, Version, Colors, Transparent BG

[](#6-ecc-level-version-colors-transparent-bg)

```
QrCode::text('Critical')->ecc('H')->version(2)->foreground('#111111')->background('#ffffff')->toSvg();
QrCode::text('Transparent')->background('transparent')->toSvg();
```

### 7) Wi-Fi, vCard, Alphanumeric

[](#7-wi-fi-vcard-alphanumeric)

```
QrCode::text('WIFI:S:Home;T:WPA;P:secret;;')->toSvg();

$vcard = "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+123456789\nEMAIL:john@example.com\nEND:VCARD";
QrCode::text($vcard)->toSvg();

QrCode::text('ABCD-1234 $%*+-./:')->toSvg(); // Alphanumeric mode
```

### 8) Artisan

[](#8-artisan)

```
php artisan qrcode:make "Hello" --path=storage/app/hello.png --ecc=Q --version=2 --renderer=svg --size=256 --margin=4 --fg=#000000 --bg=#ffffff
```

Configuration (config/qrcode.php)
---------------------------------

[](#configuration-configqrcodephp)

```
return [
    'version' => null, // auto
    'ecc' => 'M',
    'margin' => 4,
    'scale' => 10,
    'renderer' => 'svg', // svg|gd|imagick
    'fg_color' => '#000000',
    'bg_color' => '#ffffff',
    'eci' => false,
    'cache' => false,
    'cache_ttl' => 3600,
];
```

Troubleshooting: "the QR code won't scan"
-----------------------------------------

[](#troubleshooting-the-qr-code-wont-scan)

The encoder output is standards-compliant, so a code that fails to scan is almost always a rendering or display problem. Check the following:

- **Do not stretch the image.** Keep the QR perfectly square. When embedding the SVG, never force a non-square `width`/`height` in CSS. The SVG uses `preserveAspectRatio='xMidYMid meet'` so it letterboxes instead of distorting, but a container with `object-fit` overrides or fixed mismatched dimensions can still squash it.
- **Keep the quiet zone.** Leave the default `margin` of 4 modules. Don't crop the white border or place the code tight against other dark content.
- **Render big enough.** Aim for at least ~3–4 device pixels per module. For higher versions (longer data) increase `scale` or reduce the data length.
- **Preserve contrast.** Dark foreground on a light background. Avoid low-contrast color pairs and never invert (light modules on dark background won't scan on most readers).
- **Avoid post-processing.** Anti-aliasing, JPEG compression of small images, or scaling to non-integer multiples blurs module edges. Prefer SVG, or PNG scaled by whole numbers.
- **Shorten the payload.** Very long URLs push the symbol to a high version with tiny modules. Use a redirect/short link, or raise `scale`.

Security &amp; Performance
--------------------------

[](#security--performance)

- Validate and limit input length to prevent excessive memory usage.
- Use SVG when possible for crisp scaling. GD/Imagick are optional for PNG.
- Avoid untrusted content injection when echoing inline HTML; prefer Response helpers.

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~56 days

Recently: every ~71 days

Total

6

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1989782?v=4)[Jamal Abdul Nasir](/maintainers/jamalnasir)[@jamalnasir](https://github.com/jamalnasir)

---

Top Contributors

[![jamalnasir](https://avatars.githubusercontent.com/u/1989782?v=4)](https://github.com/jamalnasir "jamalnasir (9 commits)")

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 11, 12 and 13

217685.2k8](/packages/webwizo-laravel-shortcodes)[grafite/forms

A remarkably magical form package for Laravel.

376.8k1](/packages/grafite-forms)

PHPackages © 2026

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