Micro QR Code

Micro QR Code in PHP: versions M1 to M4, error correction, code examples and SVG output

Micro QR fits in one finder pattern instead of three, which takes the smallest symbol down to 11 modules square. Four versions, M1 to M4, and a ceiling of 35 digits: past that the data belongs in a full QR Code.

Type Token

ItemValue
Type tokenMICROQR
Enum caseBarcodeType::MICROQR
Family2D
StandardISO/IEC 18004
Class\Com\Tecnick\Barcode\Type\Square\MicroQrCode

Input

ItemValue
Character setnumeric, alphanumeric and byte data
Lengthup to 35 digits, 21 alphanumeric characters or 15 bytes at version M4
CheckReed-Solomon error correction, computed by the library
Extra parameters3 (see below)

Extra Parameters

Appended to the type token after commas, as in MICROQR,M,4,AN.

PositionMeaningValuesDefault
1error correction levelL, M, Qautomatic
2version0 for automatic, or 1 to 40
3encoding modeNM, AN, 8Bautomatic

Examples

Ten digits in the smallest symbol that fits

<?php

require_once __DIR__ . '/vendor/autoload.php';

$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
    type: 'MICROQR',
    code: '0123456789',
    width: -4,
    height: -4,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

echo $bobj->getInlineSvgCode();

Micro QR Code barcode encoding 0123456789

Version M4 with alphanumeric encoding

$bobj = $barcode->getBarcodeObj(
    type: 'MICROQR,M,4,AN',
    code: 'ABCDEFGHIJKLMNOPQR',
    width: -4,
    height: -4,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

Micro QR Code barcode encoding ABCDEFGHIJKLMNOPQR

Errors

These payloads raise \Com\Tecnick\Barcode\Exception:

PayloadMessage
``Empty input
0123456789012345678901234567890123456789MICROQR: The data does not fit in a Micro QR Code symbol

See Also