mhinspeya/module-barcode-generator
Composer 安装命令:
composer require mhinspeya/module-barcode-generator
包简介
Magento 2 module for generating 1D barcodes (Code 39, Code 128, EAN, UPC, and more)
README 文档
README
A Magento 2 module for generating 1D barcodes as PNG, SVG, or HTML output. Based on the TCPDF barcode library by Nicola Asuni.
Compatibility
| Magento | PHP |
|---|---|
| 2.4.8+ | 8.2 / 8.3 / 8.4 |
Supported Barcode Types
| Code | Description |
|---|---|
C39 | CODE 39 – ANSI MH10.8M-1983 |
C39+ | CODE 39 with checksum |
C39E | CODE 39 Extended |
C39E+ | CODE 39 Extended + checksum |
C93 | CODE 93 – USS-93 |
S25 | Standard 2 of 5 |
S25+ | Standard 2 of 5 + checksum |
I25 | Interleaved 2 of 5 |
I25+ | Interleaved 2 of 5 + checksum |
C128 | CODE 128 (auto mode) |
C128A | CODE 128 A |
C128B | CODE 128 B |
C128C | CODE 128 C |
EAN2 | 2-Digit UPC-Based Extension |
EAN5 | 5-Digit UPC-Based Extension |
EAN8 | EAN-8 |
EAN13 | EAN-13 |
UPCA | UPC-A |
UPCE | UPC-E |
MSI | MSI (Plessey variation) |
MSI+ | MSI + checksum (modulo 11) |
POSTNET | POSTNET |
PLANET | PLANET |
RMS4CC | Royal Mail 4-state Customer Code |
KIX | KIX (Klant index – Customer index) |
IMB | Intelligent Mail Barcode (USPS-B-3200) |
CODABAR | CODABAR |
CODE11 | CODE 11 |
PHARMA | PHARMACODE |
PHARMA2T | PHARMACODE Two-Tracks |
Installation
Via Composer
composer require mhinspeya/module-barcode-generator
bin/magento module:enable MHinspeya_BarcodeGenerator
bin/magento setup:upgrade
bin/magento cache:flush
Manual Installation
- Copy the module files to
app/code/MHinspeya/BarcodeGenerator/ - Run:
bin/magento module:enable MHinspeya_BarcodeGenerator
bin/magento setup:upgrade
bin/magento cache:flush
Usage
Frontend URL
The module registers a frontend route. Generate a barcode PNG by visiting:
https://your-store.com/barcode/index/barcode?code=C128&number=123456789
Parameters:
| Parameter | Description | Example |
|---|---|---|
code | Barcode type (see supported types) | C128 |
number | Value to encode | 123456789 |
Programmatic Usage
use MHinspeya\BarcodeGenerator\Helper\BarcodeHelper;
// Create a barcode instance
$barcode = new BarcodeHelper('123456789', 'C128');
// Get PNG image data as a string
$pngData = $barcode->getBarcodePNGData(2, 40, [0, 0, 0]);
// Get SVG markup
$svgCode = $barcode->getBarcodeSVGcode(2, 30, 'black');
// Get HTML markup
$htmlCode = $barcode->getBarcodeHTML(2, 30, 'black');
// Get the raw barcode array
$barcodeArray = $barcode->getBarcodeArray();
License
LGPL-3.0-or-later — Based on the TCPDF barcode library by Nicola Asuni.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2026-06-29