2 of 5 Matrix

Matrix 2 of 5 barcode in PHP: numeric input, length, code example and SVG output

Matrix 2 of 5 carries data in the spaces as well as the bars, so the same digits fit into noticeably less width than Standard 2 of 5 needs.

Type Token

ItemValue
Type tokenS25MATRIX
Enum caseBarcodeType::S25MATRIX
FamilyLinear
Class\Com\Tecnick\Barcode\Type\Linear\MatrixTwoOfFive

Input

ItemValue
Character setdigits
Length1 to 30000 characters
Checknone
Extra parametersnone

Examples

Ten digits

<?php

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

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

echo $bobj->getInlineSvgCode();

2 of 5 Matrix barcode encoding 0123456789

Errors

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

PayloadMessage
12AInvalid character: 65

See Also