PHPackages                             bacon/bacon-qr-code - 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. bacon/bacon-qr-code

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

bacon/bacon-qr-code
===================

BaconQrCode is a QR code generator for PHP.

v3.0.4(2mo ago)2.1k165.5M—8.6%225[1 issues](https://github.com/Bacon/BaconQrCode/issues)[2 PRs](https://github.com/Bacon/BaconQrCode/pulls)20BSD-2-ClausePHPPHP ^8.1CI failing

Since Aug 27Pushed 1mo ago29 watchersCompare

[ Source](https://github.com/Bacon/BaconQrCode)[ Packagist](https://packagist.org/packages/bacon/bacon-qr-code)[ Docs](https://github.com/Bacon/BaconQrCode)[ RSS](/packages/bacon-bacon-qr-code/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (22)Used By (20)

QR Code generator
=================

[](#qr-code-generator)

[![PHP CI](https://github.com/Bacon/BaconQrCode/actions/workflows/ci.yml/badge.svg)](https://github.com/Bacon/BaconQrCode/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/c288bfa562cc221d8b885237ce50317555f0214e30bf329a658d3357b21aa8b7/68747470733a2f2f636f6465636f762e696f2f67682f4261636f6e2f4261636f6e5172436f64652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d72443048634169454578)](https://codecov.io/gh/Bacon/BaconQrCode)[![Latest Stable Version](https://camo.githubusercontent.com/a6c4c86da7ebb9f6d9124bbbb1c804e8c64d389f6e6dbdb936f69f1d955c4064/68747470733a2f2f706f7365722e707567782e6f72672f6261636f6e2f6261636f6e2d71722d636f64652f762f737461626c65)](https://packagist.org/packages/bacon/bacon-qr-code)[![Total Downloads](https://camo.githubusercontent.com/1839a98882c786c60c09429fe345ef085ca1d6d09c82e2c30ec2d91112b013e8/68747470733a2f2f706f7365722e707567782e6f72672f6261636f6e2f6261636f6e2d71722d636f64652f646f776e6c6f616473)](https://packagist.org/packages/bacon/bacon-qr-code)[![License](https://camo.githubusercontent.com/354eea7b45f2690d2e601e0ced5304e3adba7ed0f3e52185bc4ea269bbc63e9a/68747470733a2f2f706f7365722e707567782e6f72672f6261636f6e2f6261636f6e2d71722d636f64652f6c6963656e7365)](https://packagist.org/packages/bacon/bacon-qr-code)

Introduction
------------

[](#introduction)

BaconQrCode is a port of QR code portion of the ZXing library. It currently only features the encoder part, but could later receive the decoder part as well.

As the Reed Solomon codec implementation of the ZXing library performs quite slow in PHP, it was exchanged with the implementation by Phil Karn.

Example usage
-------------

[](#example-usage)

```
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;

$renderer = new ImageRenderer(
    new RendererStyle(400),
    new ImagickImageBackEnd()
);
$writer = new Writer($renderer);
$writer->writeFile('Hello World!', 'qrcode.png');
```

Available image renderer back ends
----------------------------------

[](#available-image-renderer-back-ends)

BaconQrCode comes with multiple back ends for rendering images. Currently included are the following:

- `ImagickImageBackEnd`: renders raster images using the Imagick library
- `SvgImageBackEnd`: renders SVG files using XMLWriter
- `EpsImageBackEnd`: renders EPS files

### GDLib Renderer

[](#gdlib-renderer)

GD library has so many limitations, that GD support is not added as backend, but as separated renderer. Use `GDLibRenderer` instead of `ImageRenderer`. These are the limitations:

- Does not support gradient.
- Does not support any curves, so you QR code is always squared.

Example usage:

```
use BaconQrCode\Renderer\GDLibRenderer;
use BaconQrCode\Writer;

$renderer = new GDLibRenderer(400);
$writer = new Writer($renderer);
$writer->writeFile('Hello World!', 'qrcode.png');
```

Known issues
------------

[](#known-issues)

### ImagickImageBackEnd: white pixel artifacts

[](#imagickimagebackend-white-pixel-artifacts)

When using `ImagickImageBackEnd`, single white pixels may appear inside filled regions. This is most visible with margin 0 (where artifacts appear at the image edge), but can in theory occur at any position. The cause is a bug in ImageMagick's path fill rasterizer (`GetFillAlpha` in `MagickCore/draw.c`): an off-by-one error in the winding number calculation combined with an edge skipping bug in the scanline processing can incorrectly classify pixels as outside the polygon.

The bug cannot be reliably worked around in this library:

- **Canvas padding** (rendering on a larger canvas and cropping) does not work because the required padding depends on the scale factor, path complexity, and ImageMagick's internal edge processing state. No fixed padding value is safe for all inputs.
- **Post-processing** (scanning for and fixing isolated white pixels) risks corrupting legitimate rendering features such as curved module edges.

For artifact-free output, use `SvgImageBackEnd` or `GDLibRenderer` instead.

Development
-----------

[](#development)

To run unit tests, you need to have [Node.js](https://nodejs.org/en) and the pixelmatch library installed. Running `npm install` will install this for you.

###  Health Score

79

—

ExcellentBetter than 100% of packages

Maintenance89

Actively maintained with recent releases

Popularity81

Widely adopted with strong download metrics

Community55

Growing community involvement

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 58.4% 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 ~269 days

Recently: every ~174 days

Total

18

Last Release

64d ago

Major Versions

1.0.3 → 2.0.02018-04-25

2.0.8 → v3.0.02024-04-18

PHP version history (5 changes)1.0.0PHP &gt;=5.3.3

1.0.3PHP ^5.4|^7.0

2.0.0PHP ^7.1

2.0.3PHP ^7.1 || ^8.0

v3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0490627b04e8600f8227138bac3d4aea04c22eecfa119e73b47c362363904847?d=identicon)[DASPRiD](/maintainers/DASPRiD)

---

Top Contributors

[![DASPRiD](https://avatars.githubusercontent.com/u/233300?v=4)](https://github.com/DASPRiD "DASPRiD (132 commits)")[![williamdes](https://avatars.githubusercontent.com/u/7784660?v=4)](https://github.com/williamdes "williamdes (19 commits)")[![Thinkscape](https://avatars.githubusercontent.com/u/270528?v=4)](https://github.com/Thinkscape "Thinkscape (14 commits)")[![vlakoff](https://avatars.githubusercontent.com/u/544424?v=4)](https://github.com/vlakoff "vlakoff (12 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![JercSi](https://avatars.githubusercontent.com/u/5267726?v=4)](https://github.com/JercSi "JercSi (7 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (5 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (3 commits)")[![wyattoday](https://avatars.githubusercontent.com/u/11202536?v=4)](https://github.com/wyattoday "wyattoday (2 commits)")[![mustanggb](https://avatars.githubusercontent.com/u/1636013?v=4)](https://github.com/mustanggb "mustanggb (2 commits)")[![rodrigost23](https://avatars.githubusercontent.com/u/1831465?v=4)](https://github.com/rodrigost23 "rodrigost23 (2 commits)")[![ausi](https://avatars.githubusercontent.com/u/367169?v=4)](https://github.com/ausi "ausi (2 commits)")[![kelunik](https://avatars.githubusercontent.com/u/2743004?v=4)](https://github.com/kelunik "kelunik (1 commits)")[![michaeldyrynda](https://avatars.githubusercontent.com/u/558441?v=4)](https://github.com/michaeldyrynda "michaeldyrynda (1 commits)")[![pdalfarr](https://avatars.githubusercontent.com/u/1537201?v=4)](https://github.com/pdalfarr "pdalfarr (1 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (1 commits)")[![SimplyCorey](https://avatars.githubusercontent.com/u/624784?v=4)](https://github.com/SimplyCorey "SimplyCorey (1 commits)")[![VincentLanglet](https://avatars.githubusercontent.com/u/9052536?v=4)](https://github.com/VincentLanglet "VincentLanglet (1 commits)")[![vivekwaah](https://avatars.githubusercontent.com/u/37473661?v=4)](https://github.com/vivekwaah "vivekwaah (1 commits)")[![jamieburchell](https://avatars.githubusercontent.com/u/3270426?v=4)](https://github.com/jamieburchell "jamieburchell (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

PHPackages © 2026

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