PHPackages                             biohzrdmx/qrc-php - 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. biohzrdmx/qrc-php

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

biohzrdmx/qrc-php
=================

Lightweight QR code generator

1.1.2(10mo ago)03381MITPHPPHP &gt;=8.1

Since Aug 28Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/biohzrdmx/qrc-php)[ Packagist](https://packagist.org/packages/biohzrdmx/qrc-php)[ RSS](/packages/biohzrdmx-qrc-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

qrc-php
=======

[](#qrc-php)

Lightweight QR code generator

The QR generation logic was sourced from . It was cleaned-up, type-hinted and tested under PHP 8.2.5.

### Basic usage

[](#basic-usage)

First require `biohzrdmx/qrc-php` with Composer.

To create a `QrCode` instance you will need to pass a `RendererInterface` implementation instance, there are five included:

- `GifRenderer` - Renders a GIF image
- `JpegRenderer` - Renders a JPEG image
- `PngRenderer` - Renders a PNG image
- `SvgRenderer` - Renders a SVG image
- `WebpRenderer` - Renders a WEBP image

For this example we'll use the `SvgRenderer`:

```
use Qrc\QrCode;
use Qrc\Renderer\SvgRenderer;

$renderer = new SvgRenderer();
$qr = QrCode::newInstance($renderer)
	->setData('https://example.com')
	->render()
	->toHtml(true);
```

The above code sets the data to an URL, renders the code and shows it in an HTML `img` tag.

You can also save the resulting image:

```
use Qrc\QrCode;
use Qrc\Renderer\SvgRenderer;

$renderer = new SvgRenderer();
$qr = QrCode::newInstance($renderer)
	->setData('https://example.com')
	->render()
	->toFile('qr.svg');
```

Starting from version 1.1 you may also write directly to a `PSR-7` `StreamInterface` implementation, just call the `toStream` method:

```
use Qrc\QrCode;
use Qrc\Renderer\SvgRenderer;

$stream = $response->getBody(); // $response being a PSR-7 ResponseInterface implementation
$renderer = new SvgRenderer();
$qr = QrCode::newInstance($renderer)
	->setData('https://example.com')
	->render()
	->toStream($stream);
```

Please do note that in order to use this you **must** `require` a `PSR-7` implementation and pass an instance of a `StreamInterface` implementation.

#### Advanced options

[](#advanced-options)

All of the renderers support changing the background and fill colors, as well as the padding and scale.

You can set them up by passing those parameters directly to the renderer constructor o by using the setter functions:

```
use Qrc\Renderer\SvgRenderer;

$renderer = new SvgRenderer('#222', '#FAFAFA', 30, 2); # Use a 30px padding and 2x scale
```

Is the same as:

```
use Qrc\Renderer\SvgRenderer;

$renderer = new SvgRenderer();
$renderer->setFillColor('#222');
$renderer->setBackColor('#FAFAFA');
$renderer->setPadding(30);
$renderer->setScale(2);
```

You can also change the error correction level by specifying it when creating the QrCode instance:

```
use Qrc\QrCode;
use Qrc\ErrorCorrection;
use Qrc\Renderer\SvgRenderer;

$renderer = new SvgRenderer();
$qr = QrCode::newInstance($renderer, ErrorCorrection::Medium);
```

As per-spec, there are four error correction levels (from lowest to highest):

- `ErrorCorrection::Low`
- `ErrorCorrection::Medium`
- `ErrorCorrection::Quartile`
- `ErrorCorrection::High`

### Licensing

[](#licensing)

This software is released under the MIT license.

Copyright © 2023 biohzrdmx

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Credits

[](#credits)

**Lead coder:** biohzrdmx [github.com/biohzrdmx](http://github.com/biohzrdmx)

### Trademark Notice

[](#trademark-notice)

The word "QR Code" is a registered trademark of DENSO WAVE INCORPORATED

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance55

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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 ~231 days

Total

4

Last Release

300d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44b968bb45d47a621ce8e81c422ef4c126316a702156a7faf96df75610cc0d45?d=identicon)[biohzrdmx](/maintainers/biohzrdmx)

---

Top Contributors

[![biohzrdmx](https://avatars.githubusercontent.com/u/2053303?v=4)](https://github.com/biohzrdmx "biohzrdmx (6 commits)")

---

Tags

composer-libraryphpqrcodeqrcode-generator

### Embed Badge

![Health badge](/badges/biohzrdmx-qrc-php/health.svg)

```
[![Health](https://phpackages.com/badges/biohzrdmx-qrc-php/health.svg)](https://phpackages.com/packages/biohzrdmx-qrc-php)
```

PHPackages © 2026

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