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

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

codeages/qrcode
===============

Endroid QR Code

2.2.4(8y ago)021MITPHPPHP &gt;=5.6

Since Oct 27Pushed 8y ago3 watchersCompare

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

READMEChangelogDependencies (15)Versions (61)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 in an easy way and provides a Symfony bundle for rapid integration in your project.

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

[](#installation)

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

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

Usage
-----

[](#usage)

```
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\LabelAlignment;
use Endroid\QrCode\QrCode;
use Symfony\Component\HttpFoundation\Response;

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

// Set advanced options
$qrCode
    ->setWriterByName('png')
    ->setMargin(10)
    ->setEncoding('UTF-8')
    ->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH)
    ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0])
    ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255])
    ->setLabel('Scan the code', 16, __DIR__.'/../assets/noto_sans.otf', LabelAlignment::CENTER)
    ->setLogoPath(__DIR__.'/../assets/symfony.png')
    ->setLogoWidth(150)
    ->setValidateResult(false)
;

// Directly output the QR code
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();

// Save it to a file
$qrCode->writeFile(__DIR__.'/qrcode.png');

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

[![QR Code](https://camo.githubusercontent.com/450470d1b9809c782e38e3a2282b6a347d5357caa1838fd23c2d788f9d71c3cf/687474703a2f2f656e64726f69642e6e6c2f7172636f64652f446974253230697325323065656e253230746573742e706e67)](https://camo.githubusercontent.com/450470d1b9809c782e38e3a2282b6a347d5357caa1838fd23c2d788f9d71c3cf/687474703a2f2f656e64726f69642e6e6c2f7172636f64652f446974253230697325323065656e253230746573742e706e67)

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

[](#symfony-integration)

Register the Symfony bundle in the kernel.

```
// app/AppKernel.php

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

The bundle makes use of a factory to create QR codes. The default parameters applied by the factory can optionally be overridden via the configuration.

```
endroid_qr_code:
    writer: 'png'
    size: 300
    margin: 10
    foreground_color: { r: 0, g: 0, b: 0 }
    background_color: { r: 255, g: 255, b: 255 }
    error_correction_level: low # low, medium, quartile or high
    encoding: UTF-8
    label: Scan the code
    label_font_size: 20
    label_alignment: left # left, center or right
    label_margin: { b: 20 }
    logo_path: '%kernel.root_dir%/../vendor/endroid/qrcode/assets/symfony.png'
    logo_width: 150
    validate_result: false # checks if the result is readable
```

The readability of a QR code is primarily determined by the size, the input length, the error correction level and any possible logo over the image. The `validate_result` option uses a built-in reader to validate the resulting image. This does not guarantee that the code will be readable by all readers but this helps you provide a minimum level of quality. Take note that the validator can consume quite an amount of resources and is disabled by default.

Now you can retrieve the factory from the service container and create a QR code. For instance in your controller this would look like this.

```
$qrCode = $this->get('endroid.qrcode.factory')->create('QR Code', ['size' => 200]);
```

Add the following section to your routing to be able to handle QR code URLs. This step can be skipped if 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 followed by any of the supported extensions.

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

[](#twig-extension)

The bundle provides a Twig extension for generating a QR code URL, path or data URI. You can use the second argument of any of these functions to override any defaults defined by the bundle or set via your configuration.

```

```

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

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% 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 ~29 days

Recently: every ~13 days

Total

60

Last Release

3218d ago

Major Versions

1.x-dev → 2.0.02017-04-17

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

1.8.0PHP &gt;=5.4

2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e6f8246b2e0cf9bb1e36263675cd2f86128fde2b44b7db515af38d98d75fb65?d=identicon)[Wellming](/maintainers/Wellming)

---

Top Contributors

[![endroid](https://avatars.githubusercontent.com/u/537253?v=4)](https://github.com/endroid "endroid (143 commits)")[![ThomasLandauer](https://avatars.githubusercontent.com/u/1054469?v=4)](https://github.com/ThomasLandauer "ThomasLandauer (4 commits)")[![juuuuuu](https://avatars.githubusercontent.com/u/1769769?v=4)](https://github.com/juuuuuu "juuuuuu (3 commits)")[![edorfaus](https://avatars.githubusercontent.com/u/112590?v=4)](https://github.com/edorfaus "edorfaus (2 commits)")[![ice6](https://avatars.githubusercontent.com/u/889040?v=4)](https://github.com/ice6 "ice6 (2 commits)")[![janunger](https://avatars.githubusercontent.com/u/391021?v=4)](https://github.com/janunger "janunger (1 commits)")[![kernel64](https://avatars.githubusercontent.com/u/1070435?v=4)](https://github.com/kernel64 "kernel64 (1 commits)")[![marcosgdf](https://avatars.githubusercontent.com/u/168744?v=4)](https://github.com/marcosgdf "marcosgdf (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![rk](https://avatars.githubusercontent.com/u/58199?v=4)](https://github.com/rk "rk (1 commits)")[![skruppy](https://avatars.githubusercontent.com/u/1025575?v=4)](https://github.com/skruppy "skruppy (1 commits)")[![Slamdunk](https://avatars.githubusercontent.com/u/152236?v=4)](https://github.com/Slamdunk "Slamdunk (1 commits)")[![smurfy](https://avatars.githubusercontent.com/u/805790?v=4)](https://github.com/smurfy "smurfy (1 commits)")[![stewartadam](https://avatars.githubusercontent.com/u/77808?v=4)](https://github.com/stewartadam "stewartadam (1 commits)")[![AlexKovalevych](https://avatars.githubusercontent.com/u/577231?v=4)](https://github.com/AlexKovalevych "AlexKovalevych (1 commits)")[![vtalbot](https://avatars.githubusercontent.com/u/1474848?v=4)](https://github.com/vtalbot "vtalbot (1 commits)")[![dias2000md](https://avatars.githubusercontent.com/u/17201244?v=4)](https://github.com/dias2000md "dias2000md (1 commits)")[![githubjeka](https://avatars.githubusercontent.com/u/874234?v=4)](https://github.com/githubjeka "githubjeka (1 commits)")[![gseric](https://avatars.githubusercontent.com/u/1708939?v=4)](https://github.com/gseric "gseric (1 commits)")[![irfanevrens](https://avatars.githubusercontent.com/u/166640?v=4)](https://github.com/irfanevrens "irfanevrens (1 commits)")

---

Tags

qrcodeqrsymfonybundlecodeendroid

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/codeages-qrcode/health.svg)](https://phpackages.com/packages/codeages-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)[fsi/datagrid-bundle

FSi Datagrid Bundle

1859.8k1](/packages/fsi-datagrid-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)
