PHPackages                             ashus/phpqrcode - 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. ashus/phpqrcode

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

ashus/phpqrcode
===============

PHP QRCode Generator Library, compatible with PHP 8.0 - 8.5

v1.1.1(3w ago)1990↓61.9%MITPHPPHP &gt;=8.0

Since Jul 22Pushed 3w agoCompare

[ Source](https://github.com/Ashus/PHPQRCode)[ Packagist](https://packagist.org/packages/ashus/phpqrcode)[ Docs](https://github.com/Ashus/PHPQRCode)[ RSS](/packages/ashus-phpqrcode/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (4)Used By (0)

PHP QRCode Library
==================

[](#php-qrcode-library)

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

[](#installation)

```
composer require ashus/phpqrcode
```

Generate a PNG file
-------------------

[](#generate-a-png-file)

```
\PHPQRCode\QRcode::png(
    text: 'Test',
    outfile: '/tmp/qrcode.png',
    level: \PHPQRCode\Constants::QR_ECLEVEL_L,
    size: 4,
    margin: 2,
);
```

The call writes a PNG QR code containing `Test` to `/tmp/qrcode.png`. Omit `outfile` to send the `Content-Type: image/png` HTTP header and PNG data directly to the output.

Get PNG data in memory
----------------------

[](#get-png-data-in-memory)

Use `pngString()` when the PNG should be returned instead of written or sent to the output:

```
$png = \PHPQRCode\QRcode::pngString(
    text: 'Test',
    level: \PHPQRCode\Constants::QR_ECLEVEL_L,
    size: 4,
    margin: 2,
);
```

`$png` contains the binary PNG data. This method does not send HTTP headers or produce output.

Error correction level
----------------------

[](#error-correction-level)

Pass one of the numeric constants from `\PHPQRCode\Constants`, for example `Constants::QR_ECLEVEL_L`. The methods also accept the strings `L`, `M`, `Q`, and `H` in either case.

Size and margin
---------------

[](#size-and-margin)

`size` is the number of pixels used for one QR-code module. It defaults to `3` and has a minimum of `1`.

`margin` is the width of the empty border around the QR code, measured in modules rather than pixels. It defaults to `4` and has a minimum of `0`.

The generated image is also constrained by `Constants::QR_PNG_MAXIMUM_SIZE` (default `1024` pixels), so a requested `size` may be reduced for large QR codes.

Acknowledgements
----------------

[](#acknowledgements)

This library is an import of PHP QR Code by Dominik Dzienia that you can find at

Based on C libqrencode library (ver. 3.1.1), Copyright (C) 2006-2010 by Kentaro Fukuchi

QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.

Reed-Solomon code encoder is written by Phil Karn, KA9Q. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance95

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~549 days

Total

3

Last Release

24d ago

PHP version history (2 changes)v1.0.5PHP &gt;=5.6

v1.1.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![aferrandini](https://avatars.githubusercontent.com/u/196210?v=4)](https://github.com/aferrandini "aferrandini (21 commits)")[![Ashus](https://avatars.githubusercontent.com/u/11474712?v=4)](https://github.com/Ashus "Ashus (4 commits)")[![C-Duv](https://avatars.githubusercontent.com/u/1466273?v=4)](https://github.com/C-Duv "C-Duv (1 commits)")[![javiereguiluz](https://avatars.githubusercontent.com/u/73419?v=4)](https://github.com/javiereguiluz "javiereguiluz (1 commits)")

---

Tags

phpqrcodebarcodemaiscrm

### Embed Badge

![Health badge](/badges/ashus-phpqrcode/health.svg)

```
[![Health](https://phpackages.com/badges/ashus-phpqrcode/health.svg)](https://phpackages.com/packages/ashus-phpqrcode)
```

###  Alternatives

[marcelorodrigo/filament-barcode-scanner-field

A camera-based barcode and QR code scanner input field for Filament forms. Features a modal interface with real-time scanning.

129.4k](/packages/marcelorodrigo-filament-barcode-scanner-field)

PHPackages © 2026

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