primer/phpqrcode

A modern implementaion of QR code 2D barcode generator. Pure-php LGPL implementation based on https://phpqrcode.sourceforge.net, itself based on C libqrencode by Kentaro Fukuchi.

Maintainers

Package info

github.com/primer97/phpqrcode

pkg:composer/primer/phpqrcode

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.2.1 2026-08-03 19:03 UTC

This package is auto-updated.

Last update: 2026-08-05 12:45:25 UTC


README

PHP QRCode Generator Library for php 7.3 and later.

A modern implementaion of QR code 2D barcode generator. Pure-php LGPL implementation based on inital phpqrcode, itself based on C libqrencode.

Installation

Type on the terminal composer require primer/phpqrcode

Or, by adding this entry on the composer.json file

{
    "require": {
        "primer/phpqrcode": "~1"
   }
}

Usage

Encode "data" into a png file:

QRcode::png("data", "path/to/file.png");

QR

Options

QRcode::png($text, $outfile , 
            correctionLevel: QRConstants::QR_ECLEVEL_L, 
            size: 3, 
            margin: 4, 
            saveandprint: false);

Correction Level

(int) correction level, fom the lowest to highest:

  • QRConstants::QR_ECLEVEL_L 0
  • QRConstants::QR_ECLEVEL_M 1
  • QRConstants::QR_ECLEVEL_Q 2
  • QRConstants::QR_ECLEVEL_H 3

Size

(int) Pixel size

Margin

(int) Raw silent zone (margin zone = raw * size)

Save and Print

(bool) Use saveAndPrint (bool) option to send to the browser both http header and image content.

Credits