PHPackages                             amirezaeb/heroqr - 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. amirezaeb/heroqr

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

amirezaeb/heroqr
================

A Powerful QR Code Management Library For PHP

v2.0.1(1w ago)9813.9k↓52.2%6MITPHPPHP ^8.2CI passing

Since Dec 11Pushed 1w ago4 watchersCompare

[ Source](https://github.com/AmirezaEb/HeroQR)[ Packagist](https://packagist.org/packages/amirezaeb/heroqr)[ Docs](https://github.com/AmirezaEb/HeroQR)[ RSS](/packages/amirezaeb-heroqr/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (4)Versions (20)Used By (0)

HeroQR - QR Code Library for PHP
================================

[](#heroqr---qr-code-library-for-php)

 [![Latest Version](https://camo.githubusercontent.com/12b64b00314969cd05fd1e8e11aa45e925bec7f726a2ad13c26f95f895abd4c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d6972657a6165622f6865726f71723f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/amirezaeb/heroqr) [![Total Downloads](https://camo.githubusercontent.com/bd5dc3817ea6d82f60529b3c1bc99be5b3d862557e92cec8f6b8e95e0145ecec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d6972657a6165622f6865726f71723f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://packagist.org/packages/amirezaeb/heroqr) [![Tests](https://camo.githubusercontent.com/d85661a04873c2b185d14a2b6c235a06ed743fda36808a3ee372a23023d91169/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416d6972657a6145622f4865726f51522f43492e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d5465737473266c6f676f3d676974687562)](https://github.com/AmirezaEb/HeroQR/actions/workflows/CI.yml) [![PHP Version](https://camo.githubusercontent.com/64fb871a5010de06874980f0098fe01d8616abf8a99bbedcb44d1e1daf99096a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616d6972657a6165622f6865726f71723f7374796c653d666f722d7468652d626164676526636f6c6f723d76696f6c6574)](https://packagist.org/packages/amirezaeb/heroqr) [![License](https://camo.githubusercontent.com/57ad060019d3255ac90ca9eec8d0106202b1b67524d5779aea73b738118ebcb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d6972657a6165622f6865726f71723f7374796c653d666f722d7468652d626164676526636f6c6f723d6f72616e6765)](https://github.com/AmirezaEb/HeroQR/blob/main/LICENSE)

HeroQR is a PHP library for generating and customizing QR codes with full control over styling and multi-format output, while remaining ISO/IEC 18004 compliant.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Getting Started](#getting-started)
- [Project Structure](#project-structure)
- [Support &amp; Sponsorship](#support--sponsorship)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)

Features
--------

[](#features)

- **Customization**

    - Logo embedding with size control
    - Full color control (RGB/RGBA with transparency)
    - Custom labels with alignment, styling, and spacing
    - Automatic layout optimization for readability
- **Geometric Styling**

    - Custom module shapes
    - Custom corner markers and cursors
    - Multiple predefined design styles (S, M, C sets)
    - SVG and PNG support for advanced rendering
- **Data Support**

    - Generate QR codes for URLs, text, emails, vCards, WiFi, and more
    - Support for UTF-8 / UTF-16 / Base64 encoding
- **Validation**

    - Built-in validation for URLs, emails, phones, IPs, and WiFi credentials
- **Export Formats**

    - PNG, SVG, PDF, WebP, EPS, GIF, Binary output support
- **Reliability**

    - Framework-agnostic, Laravel-ready design
    - Extensive test coverage ensuring ISO/IEC 18004 compliance

Getting Started
---------------

[](#getting-started)

### 1. Installation

[](#1-installation)

Use [Composer](https://getcomposer.org/) to install the library. Also make sure you have enabled and configured the [GD extension](https://www.php.net/manual/en/book.image.php) if you want to generate images.

```
composer require amirezaeb/heroqr
```

### 2. Basic Usage

[](#2-basic-usage)

#### Example:

[](#example)

```
use HeroQR\Core\QRCodeGenerator;

$qrCode = (new QRCodeGenerator())
    ->setData('https://test.org')
    ->generate();

$qrCode->saveTo('qrcode');
```

The `saveTo()` method automatically resolves and appends the appropriate file extension based on the selected output format.

### 3. Advanced Customization

[](#3-advanced-customization)

Advanced configuration options for full control over QR code generation and validation.

**Granular Customization:** Fine-tune colors, size, logos, and typography.
**Smart Validation:** Use the optional `DataType` to automatically validate inputs like URL, Email, Phone, Wi-Fi, and more.

#### Example:

[](#example-1)

```
use HeroQR\Core\QRCodeGenerator;
use HeroQR\DataTypes\DataType;

$qrCode = (new QRCodeGenerator())
    ->setData('aabrahimi1718@gmail.com', DataType::Email)
    ->setBackgroundColor(255, 255, 255, 0)
    ->setColor(0, 100, 200)
    ->setSize(1000)
    ->setLogo('../assets/HeroExpert.png', 100)
    ->setMargin(0)
    ->setEncoding('CP866')
    ->setErrorCorrectionLevel('Medium')
    ->setBlockSizeMode('None')
    ->setLabel(
        label: 'To Contact Me, Just Scan This QRCode',
        textAlign: 'left',
        textColor: ['r' => 0, 'g' => 100, 'b' => 200],
        fontSize: 35,
        margin: [15, 15, 15, 15]
    )
    ->generate('webp');

$qrCode->saveTo('custom-qrcode');
```

### 4. Customizing Shapes, Markers, and Cursors

[](#4-customizing-shapes-markers-and-cursors)

HeroQR supports custom styling for QR modules, corner markers, and alignment cursors.

> This feature is available for **PNG** and **SVG** output formats.

#### Available Options:

[](#available-options)

- **Shapes (Modules):** `S1` to `S4`
- **Markers (Corners):** `M1` to `M6`
- **Cursors (Inner Markers):** `C1` to `C6`

#### Example:

[](#example-2)

```
use HeroQR\Core\QRCodeGenerator;

$qrCode = (new QRCodeGenerator())
    ->setData('https://github.com/amirezaeb/heroqr')
    ->setSize(800)
    ->setBackgroundColor(0, 0, 0, 0)
    ->setColor(0, 100, 200)
    ->generate('svg',[
            'Shape' => 'S2',
            'Marker' => 'M2',
            'Cursor' => 'C2'
        ]);

$qrCode->saveTo('custom-qr');
```

**Examples**

CombinationShape (Body)Marker (Corner)Cursor (Inner)Preview**S1-M1-C1**Square (Default)Square (Default)Square (Default)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S1-M1-C1.png)**S2-M2-C2**Circle (Custom)Circle (Custom)Circle (Custom)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S2-M2-C2.png)**S3-M3-C3**Star (Custom)D-Drop-O (Custom)D-Drop-O (Custom)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S3-M3-C3.png)**S4-M4-C4**Diamond (Custom)D-Drop-I (Custom)D-Drop-I (Custom)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S4-M4-C4.png)**S4-M5-C5**Diamond (Custom)D-Drop-IO (Custom)D-Drop-IO (Custom)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S4-M5-C5.png)**S4-M6-C6**Diamond (Custom)Square-O (Custom)Square-O (Custom)[View](https://raw.githubusercontent.com/AmirezaEb/AmirezaEb/main/assets/img/QrCode/Qr-S4-M6-C6.png)### 5. Advanced Output Options

[](#5-advanced-output-options)

HeroQR supports multiple output formats for flexible usage in web, CLI, and custom rendering environments.

### Available Outputs

[](#available-outputs)

- Raw string representation
- Matrix object / 2D array
- Base64 Data URI (for direct HTML embedding)
- Multi-format export (PNG, SVG, GIF, WebP, EPS, PDF)

#### Example:

[](#example-3)

```
use HeroQR\Core\QRCodeGenerator;

$qrCode = (new QRCodeGenerator())
    ->setData('https://test.org')
    ->generate();

# Raw binary string
$string = $qrCode->getString();

# Matrix object
$matrix = $qrCode->getMatrix();

# 2D array
$matrixArray = $qrCode->getMatrixAsArray();

# Base64 Data URI
$dataUri = $qrCode->getDataUri();

# Save to file
$qrCode->saveTo('qr_code_output');
```

Project Structure
-----------------

[](#project-structure)

HeroQR follows a modular architecture designed for scalability and maintainability.

```
src/
├── Contracts/
├── Core/
├── DataTypes/
├── Managers/
├── Customs/
└── Tests/

```

### Module Overview:

[](#module-overview)

- **Contracts:** Core interfaces defining system boundaries and extensibility
- **Core:** QR code generation engine
- **DataTypes:** Input validation layer for structured data (URL, Email, WiFi, etc.)
- **Managers:** Feature orchestration and lifecycle handling
- **Customs:** Visual customization layer (Shapes, Markers, Cursors)
- **Tests:** Unit and integration test suite

Support &amp; Sponsorship
-------------------------

[](#support--sponsorship)

If HeroQR is useful in your projects, you can support its development by:

- ⭐ Starring the repository
- 🛠 Contributing via issues or pull requests
- 💰 Donating via TON or USDT
- 💼 Contacting us for sponsorship opportunities

**GRAM (TON)**

```
UQBejif4zPS57KWzz9VcqNHgRqLiOs72--xcoMyLkbnvyvn2

```

**USDT (TRC-20)**

```
TEbQ2K3kWF1TjE4yRuqp6hTH8FRr7n7xGX

```

Organizations interested in sponsoring HeroQR or featuring their brand in the documentation may contact us via the [Contact section](#contact).

Contributing
------------

[](#contributing)

Contributions are welcome.

1. Fork the repository.
2. Create a feature or bugfix branch.
3. Implement your changes and add tests when necessary.
4. Commit your changes using the Conventional Commits format.
5. Push your branch and open a Pull Request.

Example:

```
git checkout -b feature/amazing-feature

git commit -m "feat: add support for custom frame colors"

git push origin feature/amazing-feature
```

Please provide a clear description of your changes and reference any related issues (e.g. `Fixes #123`).

License
-------

[](#license)

HeroQR is open-sourced software licensed under the [MIT License](LICENSE).

Contact
-------

[](#contact)

For inquiries, feedback, or collaborations, feel free to reach out via any of the following channels:

- **Author:** Amirreza Ebrahimi
- **Email:**
- **GitHub:** [Report an Issue](https://github.com/AmirezaEb/HeroQR/issues)
- **LinkedIn:** [Amirreza Ebrahimi](https://www.linkedin.com/in/amirezaeb)
- **Telegram:** [@a\_m\_b\_r](https://t.me/a_m_b_r)

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance98

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~33 days

Recently: every ~76 days

Total

18

Last Release

13d ago

Major Versions

v1.2.0-beta → v2.0.02026-06-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/155115172?v=4)[Amirreza Ebrahimi](/maintainers/AmirezaEb)[@AmirezaEb](https://github.com/AmirezaEb)

---

Top Contributors

[![AmirezaEb](https://avatars.githubusercontent.com/u/155115172?v=4)](https://github.com/AmirezaEb "AmirezaEb (31 commits)")

---

Tags

factorylaravel-integrationlibraryphpphp-libraryphp-toolsqr-codeqr-code-generatorqrcode-customizationphpqr codeqrcodeqrlaravelcodemanagementPHP LibraryAmirezaEbHeroQR

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/amirezaeb-heroqr/health.svg)

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.9k74.1M469](/packages/endroid-qr-code)[chillerlan/php-qrcode

A QR Code generator and reader with a user-friendly API. PHP 8.4+

2.4k36.7M283](/packages/chillerlan-php-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)

PHPackages © 2026

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