Standard 2 of 5

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

Two of the five bars in each character are wide, which is where the family takes its name. Only the bars carry data here and the spaces separate them, so the symbol is wide and very tolerant of poor printing. Digits only.

Type Token

ItemValue
Type tokenS25
Enum caseBarcodeType::S25
FamilyLinear
Class\Com\Tecnick\Barcode\Type\Linear\StandardTwoOfFive

Input

ItemValue
Character setdigits
Length1 to 30000 characters
Checknone. Use S25+ for the modulo 10 check digit
Extra parametersnone

Examples

Ten digits

<?php

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

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

echo $bobj->getInlineSvgCode();

Standard 2 of 5 barcode encoding 0123456789

Errors

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

PayloadMessage
12AInvalid character: 65

See Also