PHPackages                             aicrion/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. [Image &amp; Media](/categories/media)
4. /
5. aicrion/qrcode

ActiveLibrary[Image &amp; Media](/categories/media)

aicrion/qrcode
==============

A modern, professional PHP 8.2+ library to generate and read QR codes in multiple formats and from multiple sources.

v1.0.0(3d ago)12MITPHP &gt;=8.2

Since Jul 7Compare

[ Source](https://github.com/Aicrion/qrcode-php)[ Packagist](https://packagist.org/packages/aicrion/qrcode)[ Docs](https://github.com/aicrion/qrcode-php)[ RSS](/packages/aicrion-qrcode/feed)WikiDiscussions Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

📱 Aicrion QRCode
================

[](#-aicrion-qrcode)

A modern, professional PHP 8.2+ library to generate and read QR codes from multiple sources and in multiple formats.

 [![Tests](https://github.com/aicrion/qrcode-php/actions/workflows/tests.yml/badge.svg)](https://github.com/aicrion/qrcode-php/actions) [![Latest Version](https://camo.githubusercontent.com/784247ccb27633e28f2e7bf4ec6e46f22d59c7e6b5d2a4acd46541aaaa83734f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61696372696f6e2f7172636f64652e737667)](https://packagist.org/packages/aicrion/qrcode) [![Total Downloads](https://camo.githubusercontent.com/5d3734af8141c3b70fb8ae0738dd986e696425a8c38deb4ba03f405fa1c3557e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61696372696f6e2f7172636f64652e737667)](https://packagist.org/packages/aicrion/qrcode) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md) [![PHP Version](https://camo.githubusercontent.com/d7583679f2fa23bc68186b2e772180e9fbd9afb79c983dff6b928e19d389aae8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737376262342e737667)](https://camo.githubusercontent.com/d7583679f2fa23bc68186b2e772180e9fbd9afb79c983dff6b928e19d389aae8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737376262342e737667)

 📖 [Full Documentation](https://aicrion.github.io/qrcode-php/)

---

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

[](#-features)

- 🧱 **Modern architecture** — interfaces, immutable value objects, enums, `readonly` properties (PHP 8.2+)
- 🖼️ **Multiple output formats** — PNG, SVG, EPS, WEBP
- 📥 **Multiple input sources for reading** — file path, binary string, Base64, URL, GD image, stream resource
- 🎨 **Full customization** — size, margin, colors, error correction level, embedded logo, caption label
- 📇 **Structured payloads** — WiFi, Contact (vCard), Phone, SMS, Email, Geo location, Calendar events, URLs, with automatic type detection when reading
- 🌈 **Colored QR codes** — generate and reliably read back QR codes with fully custom foreground/background colors
- 🧪 **Fully tested** — unit and feature tests with PHPUnit
- 📦 **Zero-config Composer install** — sane, production-ready defaults out of the box
- 🧯 **Rich exception hierarchy** — precise, catchable error types for every failure mode

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

[](#-installation)

Requires PHP 8.2+ and the `gd` extension.

```
composer require aicrion/qrcode
```

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

[](#-quick-start)

### Generate a QR Code

[](#generate-a-qr-code)

```
use Aicrion\QRCode\QRCode;

$qr = QRCode::make();

// Save directly to a file
$qr->generateToFile('https://github.com/aicrion/qrcode-php', __DIR__ . '/qrcode.png');

// Get raw bytes
$bytes = $qr->generate('Hello World');

// Get a data URI (ideal for )
$uri = $qr->generateDataUri('Hello World');
```

### Read a QR Code

[](#read-a-qr-code)

```
use Aicrion\QRCode\QRCode;

$qr = QRCode::make();

$result = $qr->readFromPath(__DIR__ . '/qrcode.png');

echo $result->content; // decoded text
```

Or let the library auto-detect the source type:

```
$qr->read(__DIR__ . '/qrcode.png');      // file path
$qr->read('https://example.com/qr.png'); // URL
$qr->read($base64DataUri);               // Base64 data URI
$qr->read($binaryImageString);           // raw binary
```

🎨 Customization
---------------

[](#-customization)

```
use Aicrion\QRCode\Enums\{OutputFormat, ErrorCorrectionLevel};
use Aicrion\QRCode\ValueObjects\{QRCodeOptions, Color};

$options = (new QRCodeOptions())
    ->withSize(600)
    ->withFormat(OutputFormat::SVG)
    ->withColors(Color::fromHex('#0f172a'), Color::white())
    ->withErrorCorrection(ErrorCorrectionLevel::HIGH)
    ->withLogo(__DIR__ . '/assets/logo.png', sizeRatio: 22);

$svg = QRCode::make()->generate('https://aicrion.dev', $options);
```

📚 Supported Formats &amp; Sources
---------------------------------

[](#-supported-formats--sources)

CapabilitySupported Options**Output formats**PNG, SVG, EPS, WEBP**Error correction**LOW (L), MEDIUM (M), QUARTILE (Q), HIGH (H)**Read sources**File path, binary string, Base64/data URI, URL, GD image, stream resource🇮🇷 Persian / Farsi &amp; Unicode Support
----------------------------------------

[](#-persian--farsi--unicode-support)

Full UTF-8 support out of the box — Persian, Arabic, Chinese, emoji, etc.

```
$qr->generateToFile('سلام دنیا! این یک کد کیوآر فارسی است.', __DIR__ . '/farsi-qr.png');

$result = $qr->readFromPath(__DIR__ . '/farsi-qr.png');
echo $result->content; // سلام دنیا! این یک کد کیوآر فارسی است.
```

📇 Structured QR Codes (WiFi, Contact, Phone, etc.)
--------------------------------------------------

[](#-structured-qr-codes-wifi-contact-phone-etc)

```
use Aicrion\QRCode\Enums\WifiEncryption;

$qr->generateWifi(ssid: 'MyNetwork', password: 'secret123', encryption: WifiEncryption::WPA);
$qr->generateContact(firstName: 'Hadi', lastName: 'Akbarzadeh', phone: '+989120000000', email: 'hadi@elatel.ir');
$qr->generatePhone('+989120000000');
$qr->generateSms('+989120000000', 'Hello!');
$qr->generateEmail('hello@aicrion.dev', 'Subject', 'Body');
$qr->generateGeo(35.6892, 51.3890);
$qr->generateUrl('https://github.com/aicrion/qrcode-php');
```

Reading automatically detects and parses the payload type:

```
$result = $qr->readFromPath(__DIR__ . '/wifi.png');

echo $result->type->value; // "wifi"
print_r($result->parsed);  // ['ssid' => 'MyNetwork', 'password' => 'secret123', ...]
```

See the [Structured Payloads documentation](https://aicrion.github.io/qrcode-php/payloads.html) for the full list of supported types.

🌈 Colored QR Codes
------------------

[](#-colored-qr-codes)

```
use Aicrion\QRCode\ValueObjects\{QRCodeOptions, Color};

$options = (new QRCodeOptions())->withColors(Color::fromHex('#0f172a'), Color::fromHex('#f8fafc'));

$qr->generateToFile('https://aicrion.dev', __DIR__ . '/branded-qr.png', $options);

// Reading colored QR codes works exactly like black & white ones
$result = $qr->readFromPath(__DIR__ . '/branded-qr.png');
echo $result->content;
```

🧯 Exception Handling
--------------------

[](#-exception-handling)

All exceptions extend `Aicrion\QRCode\Exceptions\QRCodeException`:

```
use Aicrion\QRCode\Exceptions\QRCodeException;

try {
    $result = QRCode::make()->readFromPath('/missing/file.png');
} catch (QRCodeException $e) {
    // Handles InvalidSourceException, DecodingException, GenerationException, etc.
    logger()->error($e->getMessage());
}
```

🧪 Testing
---------

[](#-testing)

```
composer install
composer test
```

📖 Documentation
---------------

[](#-documentation)

Full documentation, including the complete API reference, is available at:

****

Table of contents: Installation · Quick Start · Generating QR Codes · Reading QR Codes · Structured Payloads · Colors &amp; Styling · Configuration Options · Exception Handling · Examples · API Reference · Contributing · Changelog

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/aicrion/qrcode-php).

1. Fork the repository
2. Create a feature branch
3. Run `composer test` and `composer stan`
4. Submit your pull request

---

📜 License
---------

[](#-license)

Created with ❤️ by Aicrion. Licensed under the [MIT License](LICENSE.md). Free to use, modify, and distribute!

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance99

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12207627?v=4)[Hadi Akbarzadeh](/maintainers/nabeghe)[@nabeghe](https://github.com/nabeghe)

---

Tags

qr codeqrcodeqrgeneratorreaderbarcodedecoderphp8aicrion

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k14.4M55](/packages/milon-barcode)[2amigos/qrcode-library

QrCode Generator

2191.6M21](/packages/2amigos-qrcode-library)[linkxtr/laravel-qrcode

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

3720.4k](/packages/linkxtr-laravel-qrcode)[tuncaybahadir/quar

A simple QR Code generation tool for your projects with Laravel 10, 11, 12, 13 versions, php 8.2, 8.3, 8.4 and 8.5

79116.7k6](/packages/tuncaybahadir-quar)[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

37711.6k](/packages/yellowskies-qr-code-bundle)[akira/laravel-qrcode

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

494.8k](/packages/akira-laravel-qrcode)

PHPackages © 2026

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