PHPackages                             endroid/qr-code-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. endroid/qr-code-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

endroid/qr-code-bundle
======================

Endroid QR Code Bundle

6.1.0(5mo ago)32110.6M—9.9%45[3 issues](https://github.com/endroid/qr-code-bundle/issues)[1 PRs](https://github.com/endroid/qr-code-bundle/pulls)14MITPHPPHP ^8.4CI passing

Since Dec 2Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/endroid/qr-code-bundle)[ Packagist](https://packagist.org/packages/endroid/qr-code-bundle)[ Docs](https://github.com/endroid/qr-code-bundle)[ GitHub Sponsors](https://github.com/endroid)[ RSS](/packages/endroid-qr-code-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (46)Used By (14)Security (1)

QR Code Bundle
==============

[](#qr-code-bundle)

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

[![Latest Stable Version](https://camo.githubusercontent.com/503b6886f5ab603c4edd8a21a4e9000d2aa97f762bb3d60020d69b054eeff52f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e64726f69642f71722d636f64652d62756e646c652e737667)](https://packagist.org/packages/endroid/qr-code-bundle)[![Build Status](https://github.com/endroid/qr-code-bundle/workflows/CI/badge.svg)](https://github.com/endroid/qr-code-bundle/actions)[![Total Downloads](https://camo.githubusercontent.com/b0ea606234dbd79fe55b464b2c2234aaa6ba77cad72571f32bcbabb402720a4d/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e64726f69642f71722d636f64652d62756e646c652e737667)](https://packagist.org/packages/endroid/qr-code-bundle)[![Monthly Downloads](https://camo.githubusercontent.com/97a0809b18a844472a53972792e7edca34605d5f0f3d924444b6c01571cf31b5/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f656e64726f69642f71722d636f64652d62756e646c652e737667)](https://packagist.org/packages/endroid/qr-code-bundle)[![License](https://camo.githubusercontent.com/e7969ef2252da722607be667b99f2e092cb8a5552245d3cd5091074436129122/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e64726f69642f71722d636f64652d62756e646c652e737667)](https://packagist.org/packages/endroid/qr-code-bundle)

This Symfony bundle lets you generate QR Codes using the [endroid/qr-code](https://github.com/endroid/QrCode)library. It provides the following features:

- Configure your defaults (like image size, default writer etc.)
- Support for multiple configurations and injection via aliases
- Generate QR codes for defined configurations via URL like /qr-code//Hello
- Generate QR codes or URLs directly from Twig using dedicated functions

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

[](#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 endroid/qr-code-bundle
```

When you use Symfony, the [installer](https://github.com/endroid/installer)makes sure that services are automatically wired. If this is not the case you can find the configuration files in the `.install/symfony` folder.

If you don't want the installer to create the auto-configuration files, it can be disabled as described [here](https://github.com/endroid/installer#configuration).

Configuration
-------------

[](#configuration)

The bundle makes use of builders to create QR codes. The default parameters applied by the builder can optionally be overridden via the configuration. and multiple configurations (thus builders) can be defined.

```
endroid_qr_code:
    default:
        writer: Endroid\QrCode\Writer\PngWriter
        data: 'This is customized QR code'
        logo_path: '%kernel.project_dir%/vendor/endroid/qr-code/tests/assets/symfony.png'
        logo_resize_to_width: 150
        logo_punchout_background: true # only supported by PngWriter
        label_text: 'This is the label'
        label_font_path: '%kernel.project_dir%/vendor/endroid/qr-code/assets/noto_sans.otf'
        label_font_size: 20
        label_alignment: 'center'
    custom:
        writer: Endroid\QrCode\Writer\SvgWriter
        writer_options:
            exclude_xml_declaration: true # default: false
        data: 'This is customized QR code'
        size: 300
        encoding: 'UTF-8'
        error_correction_level: 'low' # 'low', 'medium', 'quartile', or 'high'
        round_block_size_mode: 'margin'
        validate_result: false
```

Using builders
--------------

[](#using-builders)

Each configuration results in a builder which can be injected in your classes. For instance the custom builder from the example above can be injected like this and you can override the default configuration as follows.

```
use Endroid\QrCode\Builder\BuilderInterface;

public function __construct(BuilderInterface $customQrCodeBuilder)
{
    $result = $customQrCodeBuilder->build(
        size: 400,
        margin: 20
    );
}
```

QR Code Response
----------------

[](#qr-code-response)

The bundle also provides a response object to ease rendering of the resulting image by automatically saving to contents and setting the correct content type.

```
use Endroid\QrCodeBundle\Response\QrCodeResponse;

$response = new QrCodeResponse($result);
```

Generate via URL
----------------

[](#generate-via-url)

The bundle provides a controller that allows you to generate QR codes simply by opening an URL like /qr-code/{builder}/{data}. You can configure the prefix in your routing file and pass any of the existing options via query string.

Generate via Twig
-----------------

[](#generate-via-twig)

The bundle provides a Twig extension for generating a QR code URL, path or data URI. You can use the second argument to specify the builder to use.

```

{# You can specify the builder via the second parameter #}

{# You can access the width and height via the matrix #}
{% set qrCode = qr_code_result('My QR Code') %}

```

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 source code is subject to the MIT license bundled in the file LICENSE.

###  Health Score

72

—

ExcellentBetter than 100% of packages

Maintenance77

Regular maintenance activity

Popularity66

Solid adoption and visibility

Community34

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 89.1% 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 ~66 days

Recently: every ~197 days

Total

45

Last Release

168d ago

Major Versions

3.x-dev → 4.0.02021-02-28

4.3.3 → 5.0.02023-10-02

5.0.2 → 6.0.02024-10-21

PHP version history (8 changes)3.0.0PHP &gt;=7.1

3.4.0PHP &gt;=7.2

3.x-devPHP ^7.3||^8.0

4.0.6PHP ^7.4||^8.0

4.2.0PHP ^8.0

4.3.2PHP ^8.1

6.0.0PHP ^8.2

6.1.0PHP ^8.4

### Community

Maintainers

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

---

Top Contributors

[![endroid](https://avatars.githubusercontent.com/u/537253?v=4)](https://github.com/endroid "endroid (155 commits)")[![ThomasLandauer](https://avatars.githubusercontent.com/u/1054469?v=4)](https://github.com/ThomasLandauer "ThomasLandauer (5 commits)")[![qdequippe](https://avatars.githubusercontent.com/u/3193300?v=4)](https://github.com/qdequippe "qdequippe (3 commits)")[![epitre](https://avatars.githubusercontent.com/u/1972431?v=4)](https://github.com/epitre "epitre (3 commits)")[![calvera](https://avatars.githubusercontent.com/u/432090?v=4)](https://github.com/calvera "calvera (1 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")[![Saracevas](https://avatars.githubusercontent.com/u/9380319?v=4)](https://github.com/Saracevas "Saracevas (1 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")[![markwatney2016](https://avatars.githubusercontent.com/u/22563689?v=4)](https://github.com/markwatney2016 "markwatney2016 (1 commits)")[![curry684](https://avatars.githubusercontent.com/u/1455673?v=4)](https://github.com/curry684 "curry684 (1 commits)")[![javiereguiluz](https://avatars.githubusercontent.com/u/73419?v=4)](https://github.com/javiereguiluz "javiereguiluz (1 commits)")[![maks-rafalko](https://avatars.githubusercontent.com/u/3725595?v=4)](https://github.com/maks-rafalko "maks-rafalko (1 commits)")

---

Tags

bundlecodeendroidfactoryflexqrqrcodesymfonytwigphpqrsymfonybundlecodeendroid

### Embed Badge

![Health badge](/badges/endroid-qr-code-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/endroid-qr-code-bundle/health.svg)](https://phpackages.com/packages/endroid-qr-code-bundle)
```

###  Alternatives

[lexik/translation-bundle

This bundle allows to import translation files content into the database and provide a GUI to edit translations.

4362.7M19](/packages/lexik-translation-bundle)

PHPackages © 2026

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