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

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

barretzhi/qrcode
================

Endroid QR Code

1.0.0(8y ago)011MITPHPPHP &gt;=5.4

Since Nov 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/barretzhi/QrCode)[ Packagist](https://packagist.org/packages/barretzhi/qrcode)[ Docs](https://github.com/endroid/QrCode)[ RSS](/packages/barretzhi-qrcode/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

QR Code
=======

[](#qr-code)

*By [endroid](http://endroid.nl/)*

[![Latest Stable Version](https://camo.githubusercontent.com/dafb556bcc6a3fd87ff8a077aa049b0f4253f1be37cf1b609cd7fb2dab9fe5e7/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e64726f69642f7172636f64652e737667)](https://packagist.org/packages/endroid/qrcode)[![Build Status](https://camo.githubusercontent.com/d80420f122ed38cbb2dc74bb33ac4734daa0e776521124361a8f195bc59a2f56/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f656e64726f69642f5172436f64652e737667)](http://travis-ci.org/endroid/QrCode)[![Total Downloads](https://camo.githubusercontent.com/2f365c7c48456b9da3c171cb41a789d0ec245053e31e206afbd8111e4a1b0cc1/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e64726f69642f7172636f64652e737667)](https://packagist.org/packages/endroid/qrcode)[![Monthly Downloads](https://camo.githubusercontent.com/1ddc0b19999f1573ea7336ac22b4692d17038747e744bf734d8863cd0147c458/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f656e64726f69642f7172636f64652e737667)](https://packagist.org/packages/endroid/qrcode)[![License](https://camo.githubusercontent.com/d3a4e92c65ff3310e608da7e378b0e2218fcd836a50975545c94eb077fcf888b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e64726f69642f7172636f64652e737667)](https://packagist.org/packages/endroid/qrcode)

This library helps you generate QR codes.

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install the library.

```
$ composer require endroid/qrcode
```

Usage
-----

[](#usage)

```
use Endroid\QrCode\QrCode;

// Create a QR code
$qrCode = new QrCode('Life is too short to be generating QR codes');
$qrCode->setSize(300);

// Advanced options
$qrCode
    ->setQuietZone(2)
    ->setErrorCorrectionLevel('H')
    ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0])
    ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0])
    ->setLabel('Scan the code', 16, __DIR__.'/../font/open_sans.ttf')
    ->setLogo(__DIR__.'/../logo/endroid.png', 50)
;

// now we can output the QR code
header('Content-Type: '.$qrCode->getContentType(QrCode::TYPE_PNG));
$qrCode->write(QrCode::TYPE_PNG);

// save it to a file (uses type guessing)
$qrCode->write(__DIR__.'/qrcode.png');

// create a response object
$response = new Response(
    $qrCode->write(QrCode::TYPE_SVG),
    Response::HTTP_OK,
    ['Content-Type' => $qrCode->getContentType(QrCode::TYPE_SVG)])
;
```

[![QR Code](https://camo.githubusercontent.com/9f88bc6eed574edf55582357633c3e66ff1f6ac302da7c323f91b4c3ca8e2ece/687474703a2f2f656e64726f69642e6e6c2f7172636f64652f4c6966652532306973253230746f6f25323073686f7274253230746f253230626525323067656e65726174696e672532305152253230636f6465732e706e673f6c6162656c3d5363616e253230746865253230636f6465)](https://camo.githubusercontent.com/9f88bc6eed574edf55582357633c3e66ff1f6ac302da7c323f91b4c3ca8e2ece/687474703a2f2f656e64726f69642e6e6c2f7172636f64652f4c6966652532306973253230746f6f25323073686f7274253230746f253230626525323067656e65726174696e672532305152253230636f6465732e706e673f6c6162656c3d5363616e253230746865253230636f6465)

Symfony integration
-------------------

[](#symfony-integration)

Register the Symfony bundle in the kernel.

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Endroid\QrCode\Bundle\EndroidQrCodeBundle(),
    ];
}
```

The default parameters can be overridden via the configuration.
Alpha channel available range is \[0, 127\] in foreground and background colors.

```
endroid_qr_code:
    size: 100
    quiet_zone: 2
    error_correction_level: H
    foreground_color: { r: 0, g: 0, b: 0, a: 0 }
    background_color: { r: 255, g: 255, b: 255, a: 0 }
    label: 'Scan the code'
    label_font_size: 16
```

Now you can retrieve the factory as follows.

```
$factory = $this->get('endroid.qrcode.factory');
$factory->createQrCode();
```

Add the following section to your routing to be able to handle QR code URLs. This step can be skipped when you only use data URIs to display your images.

```
EndroidQrCodeBundle:
    resource: "@EndroidQrCodeBundle/Controller/"
    type:     annotation
    prefix:   /qrcode
```

After installation and configuration, QR codes can be generated by appending the QR code text to the url as mounted, followed by .png, .jpg or .gif.

Twig extension
--------------

[](#twig-extension)

The bundle also provides a Twig extension for quickly generating QR code urls. Optional parameters are extension, size, quiet zone and errorCorrectionLevel. When a parameter is omitted, the value in the bundle configuration is used.

```

```

You can also use the data URI helper to embed the QR code within your HTML instead of requiring a separate HTTP request to load your image.

```

```

Versioning
----------

[](#versioning)

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License
-------

[](#license)

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d639f78ad2d415056a340bfd755cacf4710856b32b3a5cc7370fd833c98e04a6?d=identicon)[barretzhi](/maintainers/barretzhi)

---

Top Contributors

[![barretzhi](https://avatars.githubusercontent.com/u/10612276?v=4)](https://github.com/barretzhi "barretzhi (1 commits)")

---

Tags

qrcodeqrsymfonybundlecodeendroid

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M348](/packages/endroid-qr-code)[endroid/qr-code-bundle

Endroid QR Code Bundle

32110.6M17](/packages/endroid-qr-code-bundle)[arcanedev/qr-code

QR Code generator

1231.9k1](/packages/arcanedev-qr-code)[linkxtr/laravel-qrcode

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

295.1k](/packages/linkxtr-laravel-qrcode)

PHPackages © 2026

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