Laravel for Rust Alpha

laravel-rust-barcode

Generate linear barcodes, QR Code, Data Matrix and PDF417 in Laravel for Rust.

Encode linear and matrix barcodes and render them as SVG, HTML or images. Community package, not affiliated with Laravel.

Read the docs Source on GitHub

cargo add laravel-rust-barcode
Latest release
0.1.0, 2026-12-05
Maintenance
Active
Framework
laravel-rust 0.2.x
MSRV
Rust 1.99 or later
Licence
MIT

PHP parity

Follows milon/barcode v13.6.0 (commit aff97c2d830c). Last verified .

Parity level
Full
Abilities
79
Covered
66
Diverged
13
Planned
0
PHP fixtures
205

Fixtures are generated by PHP itself: PHP 8.5, illuminate/support v13.45.0, milon/barcode v13.6.0.

Coverage by ability
  • 1d.c39 · Covered · Core · 1 test
    DNS1D type C39 (Code 39)
  • 1d.c39_plus · Covered · 1 test
    DNS1D type C39+ (Code 39 with mod-43 checksum)
  • 1d.c39e · Covered · 1 test
    DNS1D type C39E (Code 39 Extended)
  • 1d.c39e_plus · Covered · 1 test
    DNS1D type C39E+ (Code 39 Extended with checksum)
  • 1d.c93 · Covered · 1 test
    DNS1D type C93 (Code 93)
  • 1d.s25 · Covered · 1 test
    DNS1D type S25 (Standard 2 of 5)
  • 1d.s25_plus · Covered · 1 test
    DNS1D type S25+ (Standard 2 of 5 with checksum)
  • 1d.i25 · Covered · 1 test
    DNS1D type I25 (Interleaved 2 of 5)
  • 1d.i25_plus · Covered · 1 test
    DNS1D type I25+ (Interleaved 2 of 5 with checksum)
  • 1d.c128 · Covered · Core · 1 test
    DNS1D type C128 (Code 128, automatic code sets A/B/C)
  • 1d.c128a · Covered · 1 test
    DNS1D type C128A (Code 128 code set A)
  • 1d.c128b · Covered · 1 test
    DNS1D type C128B (Code 128 code set B)
  • 1d.c128c · Covered · 1 test
    DNS1D type C128C (Code 128 code set C)
  • 1d.gs1_128 · Covered · 1 test
    DNS1D type GS1-128 (parenthesized application identifiers)
  • 1d.ean2 · Covered · 1 test
    DNS1D type EAN2 (2-digit add-on)
  • 1d.ean5 · Covered · 1 test
    DNS1D type EAN5 (5-digit add-on)
  • 1d.ean8 · Covered · 1 test
    DNS1D type EAN8
  • 1d.ean13 · Covered · Core · 1 test
    DNS1D type EAN13
  • 1d.upca · Covered · Core · 1 test
    DNS1D type UPCA
  • 1d.upce · Covered · 1 test
    DNS1D type UPCE
  • 1d.msi · Covered · 1 test
    DNS1D type MSI
  • 1d.msi_plus · Covered · 1 test
    DNS1D type MSI+ (modulo-11 checksum)
  • 1d.postnet · Covered · 1 test
    DNS1D type POSTNET
  • 1d.planet · Covered · 1 test
    DNS1D type PLANET
  • 1d.rms4cc · Covered · 1 test
    DNS1D type RMS4CC (Royal Mail 4-state)
  • 1d.kix · Covered · 1 test
    DNS1D type KIX
  • 1d.imb · Covered · 1 test
    DNS1D type IMB (Intelligent Mail barcode)
  • 1d.codabar · Covered · 1 test
    DNS1D type CODABAR
  • 1d.code11 · Covered · 1 test
    DNS1D type CODE11
  • 1d.pharma · Covered · 1 test
    DNS1D type PHARMA (Pharmacode)
  • 1d.pharma2t · Covered · 1 test
    DNS1D type PHARMA2T (two-track Pharmacode)
  • 2d.qrcode · Covered · Core · 1 test
    DNS2D type QRCODE and QRCODE,L|M|Q|H
  • 2d.datamatrix · Covered · Core · 1 test
    DNS2D type DATAMATRIX
  • 2d.pdf417 · Covered · Core · 1 test
    DNS2D type PDF417 and PDF417,aspect,ecc
  • 2d.pdf417.macro · Covered · 1 test
    DNS2D type PDF417,aspect,ecc,total,index,file-id,o0..o6 (Macro PDF417)
  • 1d.output.svg · Covered · Core · 1 test
    DNS1D::getBarcodeSVG(code, type, w = 2, h = 30, color = 'black', showCode = true, inline = false)
  • 1d.output.svg.inline · Covered · 1 test
    DNS1D::getBarcodeSVG(..., inline = true) omits the XML declaration and doctype
  • 1d.output.html · Covered · Core · 1 test
    DNS1D::getBarcodeHTML(code, type, w = 2, h = 30, color = 'black', showCode = 0)
  • 1d.output.png · Covered · Core · 1 test
    DNS1D::getBarcodePNG(code, type, w, h, color, showCode, bgcolor) returns base64
  • 1d.output.png_path · Covered · 1 test
    DNS1D::getBarcodePNGPath(..., filename = null)
  • 1d.output.png_uri · Covered · 1 test
    DNS1D::getBarcodePNGUri(code, type, w, h, color)
  • 1d.output.jpg · Covered · 1 test
    DNS1D::getBarcodeJPG(code, type, w, h, color, showCode) returns base64
  • 1d.output.jpg_path · Covered · 1 test
    DNS1D::getBarcodeJPGPath(..., filename = null)
  • 1d.output.jpg_uri · Covered · 1 test
    DNS1D::getBarcodeJPGUri(code, type, w, h, color)
  • 1d.hri.default · Covered · 1 test
    1D human-readable code under the bars (showCode, non-EAN/UPC)
  • 1d.hri.ean_upc · Covered · 1 test
    Retail EAN-8, EAN-13, UPC-A and UPC-E layout: taller guard bars and split digits
  • 1d.padding · Covered · 1 test
    DNS1D::setPadding / getPadding (quiet zone)
  • 1d.bgcolor · Covered · 1 test
    DNS1D::getBarcodePNG bgcolor (transparent by default)
  • 2d.output.svg · Covered · Core · 1 test
    DNS2D::getBarcodeSVG(code, type, w = 3, h = 3, color = 'black')
  • 2d.output.html · Covered · Core · 1 test
    DNS2D::getBarcodeHTML(code, type, w = 10, h = 10, color = 'black')
  • 2d.output.png · Covered · Core · 1 test
    DNS2D::getBarcodePNG(code, type, w, h, color, bgcolor) returns base64
  • 2d.output.png_path · Covered · 1 test
    DNS2D::getBarcodePNGPath(..., filename = null)
  • 2d.output.png_uri · Covered · 1 test
    DNS2D::getBarcodePNGUri(code, type, w, h, color)
  • 2d.padding · Covered · 1 test
    DNS2D::setPadding / getPadding (quiet zone)
  • 2d.bgcolor · Covered · 1 test
    DNS2D::getBarcodePNG bgcolor (transparent by default)
  • 2d.logo · Covered · 2 tests
    DNS2D::setLogo(path, widthPercent) / getLogoPath (centred logo on PNG output)
  • common.type_case_insensitive · Covered · 1 test
    Barcode type names match without regard to ASCII case (strtoupper)
  • common.store_path · Covered · 1 test
    setStorPath and Laravel config('barcode.store_path')
  • common.store_path.temporary · Diverged
    Implicit temporary-directory fallback outside Laravel
  • common.filename_sanitize · Covered · 1 test
    Custom filename: directory stripped, image extension removed, slug of the code as default
  • common.error.invalid_barcode · Covered · Core · 1 test
    InvalidBarcodeException (unsupported type, encoding failure with a hint)
  • common.error.wrong_check_digit · Covered · 1 test
    WrongCheckDigitException on an EAN-8, EAN-13 or UPC-A check-digit mismatch
  • 1d.codabar.caller_start_stop · Diverged
    DNS1D type CODABAR always adds A at both ends, so A1234B becomes AA1234BA
  • 1d.c39e.lowercase · Diverged
    DNS1D types C39E and C39E+ uppercase the code before the Code 39 Full ASCII expansion, so a encodes as A
  • 1d.c93.lowercase · Diverged
    DNS1D type C93 uppercases the code before expansion, so a encodes as A
  • 1d.vertical_tab · Diverged
    DNS1D types C39E, C39E+ and C93 reject byte 0x0B (InvalidBarcodeException)
  • 1d.two_of_five.empty · Diverged
    DNS1D types S25, S25+, I25 and I25+ produce a symbol for an empty payload
  • common.padding.negative · Diverged
    PHP silently clamps negative padding to zero
  • 2d.qrcode.literal_backslash_zero · Diverged
    PHP rejects the two-byte QR payload consisting of a backslash and a zero
  • 1d.c128.control_runs · Diverged
    PHP may use one SHIFT for consecutive control characters, causing loss on decode
  • common.security.markup_escape · Diverged
    The code text and colour go into SVG and HTML unescaped
  • common.security.bounds · Diverged
    Unbounded dimensions, padding and logo size
  • laravel.config.store_path · Covered · 1 test
    config('barcode.store_path') (publishable config file)
  • laravel.provider · Covered · Core · 1 test
    BarcodeServiceProvider::register / boot / provides
  • laravel.facade.dns1d · Covered · Core · 1 test
    DNS1D facade (container singleton 'DNS1D')
  • laravel.facade.dns2d · Covered · Core · 1 test
    DNS2D facade (container singleton 'DNS2D')
  • laravel.html_safe · Covered · 1 test
    Documented Blade use: {!! DNS1D::getBarcodeHTML(...) !!}
  • 1d.pharma.invalid · Diverged
    PHARMA produces a zero-width symbol for zero or non-numeric input
  • 2d.pdf417.macro.file_id · Diverged
    PHP accepts text-compacted Macro PDF417 file identifiers
Differences from PHP (13)
Implicit temporary-directory fallback outside Laravel
Framework-free callers opt in with Store::temporary(); the Laravel provider defaults to the application's public directory.
DNS1D type CODABAR always adds A at both ends, so A1234B becomes AA1234BA
A letter A-D at the first or last position is that end's start or stop character; A is added only where it is missing, and A-D elsewhere is an error. PHP adds A even when an end already has a letter and accepts letters inside the code (design/decisions/0001).
DNS1D types C39E and C39E+ uppercase the code before the Code 39 Full ASCII expansion, so a encodes as A
No uppercasing before the expansion: lowercase uses the ISO/IEC 16388 Annex A plus-shift, so the scanner reads back the caller's text (design/decisions/0001).
DNS1D type C93 uppercases the code before expansion, so a encodes as A
No uppercasing: lowercase uses the dedicated plus shift in Code 93, so the scanner reads back the caller's text (design/decisions/0001).
DNS1D types C39E, C39E+ and C93 reject byte 0x0B (InvalidBarcodeException)
Byte 0x0B is encoded as ISO/IEC 16388 Annex A and Code 93 define it, with the dollar shift followed by K, instead of being rejected because of a defect in PHP's expansion table (design/decisions/0001).
DNS1D types S25, S25+, I25 and I25+ produce a symbol for an empty payload
Both ports require at least one input digit, including the check-digit variants (design/SPEC.md section 1.3).
PHP silently clamps negative padding to zero
Negative padding is rejected as an invalid option (design/SPEC.md section 9.1).
PHP rejects the two-byte QR payload consisting of a backslash and a zero
The port preserves both payload bytes (design/SPEC.md section 9.1).
PHP may use one SHIFT for consecutive control characters, causing loss on decode
Automatic Code 128 latches to set A for the entire control run (design/SPEC.md section 2.7).
The code text and colour go into SVG and HTML unescaped
Labels are escaped and colours must fit the documented grammar.
Unbounded dimensions, padding and logo size
Payloads, render dimensions and logo decoding have explicit limits.
PHARMA produces a zero-width symbol for zero or non-numeric input
Invalid input returns a typed error instead of a blank symbol.
PHP accepts text-compacted Macro PDF417 file identifiers
Require one numeric file-ID codeword so standard decoders recover the caller's ID.

Built on

  • milon/barcode: The PHP package whose behaviour this package independently implements, following version 13.6.0.

Crates: laravel-rust-barcode, laravel-rust-barcode-core · Upstream notices

Documentation