RM4SCC

Royal Mail 4-state customer barcode in PHP: postcode input, check character, code example and SVG output

Royal Mail’s customer code puts its data in the shape of each bar: ascender, descender, both, or neither. Four states over four bars give 36 values per character, which is what an alphanumeric UK postcode needs.

Type Token

ItemValue
Type tokenRMS4CC
Enum caseBarcodeType::RMS4CC
FamilyPostal
StandardRM4SCC
Class\Com\Tecnick\Barcode\Type\Linear\RoyalMailFourCc

Input

ItemValue
Character set0-9 and A-Z
Length1 to 30000 characters
Checkone check character, appended by the library
Extra parametersnone

Examples

A postcode and delivery point

<?php

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

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

echo $bobj->getInlineSvgCode();

RM4SCC barcode encoding SN34RD1A

Errors

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

PayloadMessage
012345678!Invalid character: 33

See Also