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

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

fmassei/qr-code
===============

fmassei QR Code

v0.2(5y ago)223MITPHPPHP ^8.0

Since Mar 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/fmassei/qr-code)[ Packagist](https://packagist.org/packages/fmassei/qr-code)[ Docs](https://github.com/fmassei/qr-code)[ RSS](/packages/fmassei-qr-code/feed)WikiDiscussions main Synced 5d ago

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

QR Code
=======

[](#qr-code)

[![Latest Stable Version](https://camo.githubusercontent.com/aaba7cf076fd2ea37ae5b64654ea0843514bc9a1752d278e9ba7708f1a06e627/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666d61737365692f71722d636f64652e737667)](https://packagist.org/packages/fmassei/qr-code)[![Build Status](https://github.com/fmassei/qr-code/workflows/CI/badge.svg)](https://github.com/fmassei/qr-code/actions)[![Total Downloads](https://camo.githubusercontent.com/3ef6b2d1430a960a60b745268654423beb0532dfd89bc2c602a25d38d445eac2/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666d61737365692f71722d636f64652e737667)](https://packagist.org/packages/fmassei/qr-code)[![Monthly Downloads](https://camo.githubusercontent.com/28fbc0d7de8cae58ac09ddf0896d18f1fac57389e5159b53c14067ccf8334843/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f666d61737365692f71722d636f64652e737667)](https://packagist.org/packages/fmassei/qr-code)[![License](https://camo.githubusercontent.com/faca15c3cfc46d8846b89f4e0281503c1ae494c2b770b82e73f32d2b709c1be9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666d61737365692f71722d636f64652e737667)](https://packagist.org/packages/fmassei/qr-code)

This library helps you create QR codes in SVG, PNG, and binary format.

- Use the Imagick extension to render self-generated SVG images.
- Logo and label placement
- Can use of SVG frames
- Common generation options
- Matrix generated by [bacon/bacon-qr-code](https://github.com/Bacon/BaconQrCode)
- Simple internal structure

This library is based on the structure of [endroid/qr-code](https://github.com/endroid/qr-code), trying to overcome many deal-breaker characteristics present at the time of forking. Among the bigger changes:

- Unified drawing (so results look the same in all formats)
- Switch from GD to Imagick (for SVG support)
- Switch from SimpleXMLElement to DOMDocument (more complex operations on SVG nodes)

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

[](#installation)

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

```
$ composer require fmassei/qr-code
```

Usage: generation and options
-----------------------------

[](#usage-generation-and-options)

```
use fmassei\QrCode\QrCode;
use fmassei\QrCode\Logo;
use fmassei\QrCode\Label;
use fmassei\QrCode\Writer\PngWriter;

/* to create a code, make an instance of the QrCode class */
$qrCode = new QrCode("QR code data");

/* override some default settings */
$qrCode->size = 400;
$qrCode->foregroundColor = '#f00';
$qrCode->errorCorrectionLevel = QrCode::ERROR_CORRECTION_LEVEL_MEDIUM;

/* to set the optional logo and a label */
$qrCode->logo = Logo::fromPath(__DIR__.'/mylogo.png');
$qrCode->label = new Label("My first code!");

/* use a writer to generate the result */
$result = (new PngWriter())->write($qrCode);

```

Usage: working with results
---------------------------

[](#usage-working-with-results)

```
/* Directly output the QR code */
header('Content-Type: '.$result->getMimeType());
echo $result->getString();

/* Save it to a file */
$result->saveToFile(__DIR__.'/qrcode.png');

/* Generate a data URI to include image data inline (i.e. inside an  tag) */
$dataUri = $result->getDataUri();
```

[![QR code example](tests/assets/code%20example.png)](tests/assets/code%20example.png)

One liner
---------

[](#one-liner)

Everyone expects it, I guess.

```
echo (new PngWriter())->write(new QrCode($myData))->getString();
```

SVG frames
----------

[](#svg-frames)

A frame is a template for outputting code, logo and label. The library recognizes any element inside the SVG frame with id equals to:

- `SVGFrame::IDQrCode` (default "QrCode"): this element will be subsituted with the QR code matrix
- `SVGFrame::IDLogo` (default "Logo"): this element will be substituted with the passed Logo image (if any). No other variable of the Logo object is used.
- `SVGFrame::IDLabel` (default "Label"): the *value of this node* will be substituted with the label text. No other variable of the Label object is used.

An example of the SVG structure and usage is available in the tests.

[![SVGFrame example](tests/assets/frame%20example.png)](tests/assets/frame%20example.png)

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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~1 days

Total

2

Last Release

1878d ago

### Community

Maintainers

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

---

Top Contributors

[![fmassei](https://avatars.githubusercontent.com/u/6201254?v=4)](https://github.com/fmassei "fmassei (14 commits)")

---

Tags

phpphp-libraryqr-codeqr-codesqrcodeqrcode-generatorqrcodessvg-framephpqrcodeqrcodeendroidfmassei

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

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

A Powerful QR Code Management Library For PHP

9510.3k](/packages/amirezaeb-heroqr)[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)
