The Intelligent Mail Barcode replaced POSTNET and PLANET with one symbol carrying both routing and tracking: a 20-digit tracking code, then optionally a routing code of 5, 9 or 11 digits after a dash.
The result is always 65 four-state bars. Getting there takes an 11-bit cyclic redundancy check and a conversion through 13-bit codewords, which is where the bcmath extension earns its place: without it the library falls back to its own arbitrary precision arithmetic.
Type Token
| Item | Value |
|---|---|
| Type token | IMB |
| Enum case | BarcodeType::IMB |
| Family | Postal |
| Standard | USPS-B-3200 |
| Class | \Com\Tecnick\Barcode\Type\Linear\Imb |
Input
| Item | Value |
|---|---|
| Character set | digits, with - separating the tracking code from the routing code |
| Length | 20 digits, optionally followed by - and 5, 9 or 11 digits |
| Check | an 11-bit CRC, computed by the library |
| Extra parameters | none |
Examples
Tracking and routing
<?php
require_once __DIR__ . '/vendor/autoload.php';
$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
type: 'IMB',
code: '01234567094987654321-01234567891',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
echo $bobj->getInlineSvgCode();
Tracking only
$bobj = $barcode->getBarcodeObj(
type: 'IMB',
code: '01234567094987654321',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
Errors
These payloads raise \Com\Tecnick\Barcode\Exception:
| Payload | Message |
|---|---|
0123456709498765432A | Invalid tracking number |
See Also
- tc-lib-barcode : the library overview.
- Rendering Options : size, colour, padding.
- Output Formats : every renderer.
- Intelligent Mail Barcode, pre-processed : the same symbol from a prepared bar string.
- POSTNET : one of the two formats it replaced.
- API reference : the generated class documentation.