Download the PHP package erajkhatiwada/imb without Composer

On this page you can find all versions of the php package erajkhatiwada/imb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imb

IMB - USPS Intelligent Mail Barcode Library for PHP

PHP Version

A lightweight PHP library for encoding and decoding USPS Intelligent Mail Barcodes (IMB).

Note: This is a PHP port/wrapper of the original Node.js library BossRoxall/imb created by BossRoxall. All credit for the original algorithm implementation goes to the original author.

Features

Installation

Via Composer

Manual Installation

  1. Clone the repository
  2. Run composer install

Quick Start

Encoding

Decoding

Validation

Stringify

Convert IMB data to a concatenated numeric string (useful for display or comparison):

Input Fields

Required Fields

Field Description Format
barcode_id Barcode identifier 2 digits, second digit must be 0-4
service_type Service type code 3 digits
mailer_id USPS mailer ID 6 or 9 digits
serial_num Serial number Varies (mailer_id + serial_num = 15 digits)

Optional Fields (Routing)

Field Description Format
zip ZIP code 5 digits
plus4 ZIP+4 extension 4 digits (requires zip)
delivery_pt Delivery point 2 digits

Output Format

The barcode is a 65-character string using only these characters:

CLI Usage

The library includes a command-line interface:

Advanced Usage

Using IMBData Objects

Using Encoder/Decoder Directly

Error Handling

Damaged Barcode Recovery

The decoder can attempt to recover damaged barcodes:

API Reference

IMB (Static Facade)

Method Description
encode(array\|IMBData $data): string Encode to barcode
decode(string $barcode): DecodeResult Decode barcode
decodeToArray(string $barcode): array Decode to array
validate(array\|IMBData $data): bool Validate input data
validateBarcode(string $barcode): bool Validate barcode string
stringify(array\|IMBData $data): string Convert to numeric string
createData(array $data): IMBData Create IMBData object
getEncoder(): Encoder Get encoder instance
getDecoder(): Decoder Get decoder instance

IMBData

Property Type Description
barcodeId string 2-digit barcode ID
serviceType string 3-digit service type
mailerId string 6 or 9 digit mailer ID
serialNum string Serial number
zip ?string 5-digit ZIP
plus4 ?string 4-digit ZIP+4
deliveryPt ?string 2-digit delivery point
Method Description
fromArray(array $data): IMBData Create from associative array
toArray(): array Convert to associative array
stringify(): string Convert to concatenated numeric string
getMailerIdLength(): int Get mailer ID length (6 or 9)
hasNineDigitMailerId(): bool Check if 9-digit mailer ID

DecodeResult

Property Type Description
data IMBData Decoded data
message ?string Status message
suggest ?string Suggested correction
highlight ?array Positions that differ

Testing

Requirements

License

This project is released under the CC0 1.0 Universal (Public Domain) license, same as the original Node.js library.

Acknowledgments

This PHP library is a direct port of the excellent Node.js IMB library created by BossRoxall. The encoding/decoding algorithms, bit permutation tables, and overall architecture are derived from that original work.

Special thanks to:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Related Projects


All versions of imb with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package erajkhatiwada/imb contains the following files

Loading the files please wait ...