PHP Class Milon\Barcode\DNS1D

Author: dinesh
Afficher le fichier Open project: milon/barcode Class Usage Examples

Protected Properties

Свойство Type Description
$barcode_array Array representation of barcode.
$store_path path to save png in getBarcodePNGPath

Méthodes publiques

Méthode Description
getBarcodeArray ( ) : array Get the array representation of last generated barcode.
getBarcodeHTML ( $code, $type, $w = 2, $h = 30, $color = 'black' ) : string Return an HTML representation of barcode.
getBarcodePNG ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : image Return a PNG image representation of barcode (requires GD or Imagick library).
getBarcodePNGPath ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : path Return a .png file path which create in server
getBarcodePNGUri ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : url Return a .png file path which create in server
getBarcodeSVG ( $code, $type, $w = 2, $h = 30, $color = 'black' ) : string Return a SVG string representation of barcode.
setStorPath ( $path )

Méthodes protégées

Méthode Description
barcode_c128 ( $code, $type = '' ) : array C128 barcodes.
barcode_codabar ( $code ) : array CODABAR barcodes.
barcode_code11 ( $code ) : array CODE11 barcodes.
barcode_code39 ( $code, $extended = false, $checksum = false ) : array CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
barcode_code93 ( $code ) : array CODE 93 - USS-93 Compact code similar to Code 39
barcode_eanext ( $code, $len = 5 ) : array UPC-Based Extentions 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers 5-Digit Ext.: Used to mark suggested retail price of books
barcode_eanupc ( $code, $len = 13 ) : array EAN13 and UPC-A barcodes.
barcode_i25 ( $code, $checksum = false ) : array Interleaved 2 of 5 barcodes.
barcode_imb ( $code ) : array IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 (requires PHP bcmath extension) Intelligent Mail barcode is a 65-bar code for use on mail in the United States.
barcode_msi ( $code, $checksum = false ) : array MSI.
barcode_pharmacode ( $code ) : array Pharmacode Contains digits (0 to 9)
barcode_pharmacode2t ( $code ) : array Pharmacode two-track Contains digits (0 to 9)
barcode_postnet ( $code, $planet = false ) : array POSTNET and PLANET barcodes.
barcode_rms4cc ( $code, $kix = false ) : array RMS4CC - CBC - KIX RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index) RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
barcode_s25 ( $code, $checksum = false ) : array Standard 2 of 5 barcodes.
binseq_to_array ( $seq, $bararray ) : array Convert binary barcode sequence to DNS1DBarcode barcode array.
checkfile ( $path )
checksum_code39 ( $code ) : char Calculate CODE 39 checksum (modulo 43).
checksum_code93 ( $code ) : string Calculate CODE 93 checksum (modulo 47).
checksum_s25 ( $code ) : integer Checksum for standard 2 of 5 barcodes.
dec_to_hex ( $number ) : string Convert large integer number to hexadecimal representation.
encode_code39_ext ( $code ) : encoded Encode a string to be used for CODE 39 Extended mode.
get128ABsequence ( $code ) : array Split text code in A/B sequence for 128 code
hex_to_dec ( $hex ) : string Convert large hexadecimal number to decimal representation (string).
imb_crc11fcs ( $code_arr ) : integer Intelligent Mail Barcode calculation of Frame Check Sequence
imb_reverse_us ( $num ) : integer Reverse unsigned short value
imb_tables ( $n, $size ) : array generate Nof13 tables used for Intelligent Mail Barcode
setBarcode ( $code, $type ) : array Set the barcode.
upce2a ( $code ) : string Convert UPC-E to UPC-A

Method Details

barcode_c128() protected méthode

Very capable code, excellent density, high reliability; in very wide use world-wide
protected barcode_c128 ( $code, $type = '' ) : array
$code (string) code to represent.
$type (string) barcode type: A, B, C or empty for automatic switch (AUTO mode)
Résultat array barcode representation.

barcode_codabar() protected méthode

Older code often used in library systems, sometimes in blood banks
protected barcode_codabar ( $code ) : array
$code (string) code to represent.
Résultat array barcode representation.

barcode_code11() protected méthode

Used primarily for labeling telecommunications equipment
protected barcode_code11 ( $code ) : array
$code (string) code to represent.
Résultat array barcode representation.

barcode_code39() protected méthode

General-purpose code in very wide use world-wide
protected barcode_code39 ( $code, $extended = false, $checksum = false ) : array
$code (string) code to represent.
$extended (boolean) if true uses the extended mode.
$checksum (boolean) if true add a checksum to the code.
Résultat array barcode representation.

barcode_code93() protected méthode

CODE 93 - USS-93 Compact code similar to Code 39
protected barcode_code93 ( $code ) : array
$code (string) code to represent.
Résultat array barcode representation.

barcode_eanext() protected méthode

UPC-Based Extentions 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers 5-Digit Ext.: Used to mark suggested retail price of books
protected barcode_eanext ( $code, $len = 5 ) : array
$code (string) code to represent.
$len (string) barcode type: 2 = 2-Digit, 5 = 5-Digit
Résultat array barcode representation.

barcode_eanupc() protected méthode

EAN13: European Article Numbering international retail product code UPC-A: Universal product code seen on almost all retail products in the USA and Canada UPC-E: Short version of UPC symbol
protected barcode_eanupc ( $code, $len = 13 ) : array
$code (string) code to represent.
$len (string) barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A
Résultat array barcode representation.

barcode_i25() protected méthode

Compact numeric code, widely used in industry, air cargo Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.
protected barcode_i25 ( $code, $checksum = false ) : array
$code (string) code to represent.
$checksum (boolean) if true add a checksum to the code
Résultat array barcode representation.

barcode_imb() protected méthode

The fields are described as follows:
  • The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0–4. The allowable encoding ranges shall be 00–04, 10–14, 20–24, 30–34, 40–44, 50–54, 60–64, 70–74, 80–84, and 90–94.
  • The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000http://it2.php.net/manual/en/function.dechex.php–999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.
  • The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999.
  • The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000–999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000–99999, 000000000–999999999, and 00000000000–99999999999.
protected barcode_imb ( $code ) : array
$code (string) code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode)
Résultat array barcode representation.

barcode_msi() protected méthode

Variation of Plessey code, with similar applications Contains digits (0 to 9) and encodes the data only in the width of bars.
protected barcode_msi ( $code, $checksum = false ) : array
$code (string) code to represent.
$checksum (boolean) if true add a checksum to the code (modulo 11)
Résultat array barcode representation.

barcode_pharmacode() protected méthode

Pharmacode Contains digits (0 to 9)
protected barcode_pharmacode ( $code ) : array
$code (string) code to represent.
Résultat array barcode representation.

barcode_pharmacode2t() protected méthode

Pharmacode two-track Contains digits (0 to 9)
protected barcode_pharmacode2t ( $code ) : array
$code (string) code to represent.
Résultat array barcode representation.

barcode_postnet() protected méthode

Used by U.S. Postal Service for automated mail sorting
protected barcode_postnet ( $code, $planet = false ) : array
$code (string) zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD.
$planet (boolean) if true print the PLANET barcode, otherwise print POSTNET
Résultat array barcode representation.

barcode_rms4cc() protected méthode

RMS4CC - CBC - KIX RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index) RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
protected barcode_rms4cc ( $code, $kix = false ) : array
$code (string) code to print
$kix (boolean) if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code.
Résultat array barcode representation.

barcode_s25() protected méthode

Used in airline ticket marking, photofinishing Contains digits (0 to 9) and encodes the data only in the width of bars.
protected barcode_s25 ( $code, $checksum = false ) : array
$code (string) code to represent.
$checksum (boolean) if true add a checksum to the code
Résultat array barcode representation.

binseq_to_array() protected méthode

Convert binary barcode sequence to DNS1DBarcode barcode array.
protected binseq_to_array ( $seq, $bararray ) : array
$seq (string) barcode as binary sequence.
$bararray (array) barcode array. òparam array $bararray DNS1DBarcode barcode array to fill up
Résultat array barcode representation.

checkfile() protected méthode

protected checkfile ( $path )

checksum_code39() protected méthode

Calculate CODE 39 checksum (modulo 43).
protected checksum_code39 ( $code ) : char
$code (string) code to represent.
Résultat char checksum.

checksum_code93() protected méthode

Calculate CODE 93 checksum (modulo 47).
protected checksum_code93 ( $code ) : string
$code (string) code to represent.
Résultat string checksum code.

checksum_s25() protected méthode

Checksum for standard 2 of 5 barcodes.
protected checksum_s25 ( $code ) : integer
$code (string) code to process.
Résultat integer checksum.

dec_to_hex() protected méthode

(requires PHP bcmath extension)
protected dec_to_hex ( $number ) : string
$number (string) number to convert specified as a string
Résultat string hexadecimal representation

encode_code39_ext() protected méthode

Encode a string to be used for CODE 39 Extended mode.
protected encode_code39_ext ( $code ) : encoded
$code (string) code to represent.
Résultat encoded string.

get128ABsequence() protected méthode

Split text code in A/B sequence for 128 code
protected get128ABsequence ( $code ) : array
$code (string) code to split.
Résultat array sequence

getBarcodeArray() public méthode

Get the array representation of last generated barcode.
public getBarcodeArray ( ) : array
Résultat array

getBarcodeHTML() public méthode

Return an HTML representation of barcode.
public getBarcodeHTML ( $code, $type, $w = 2, $h = 30, $color = 'black' ) : string
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (string) Foreground color for bar elements (background is transparent).
Résultat string HTML code.

getBarcodePNG() public méthode

Return a PNG image representation of barcode (requires GD or Imagick library).
public getBarcodePNG ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : image
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (array) RGB (0-255) foreground color for bar elements (background is transparent).
Résultat image or false in case of error.

getBarcodePNGPath() public méthode

Return a .png file path which create in server
public getBarcodePNGPath ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : path
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (array) RGB (0-255) foreground color for bar elements (background is transparent).
Résultat path or false in case of error.

getBarcodePNGUri() public méthode

Return a .png file path which create in server
public getBarcodePNGUri ( $code, $type, $w = 2, $h = 30, $color = [0, 0, 0] ) : url
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (array) RGB (0-255) foreground color for bar elements (background is transparent).
Résultat url or false in case of error.

getBarcodeSVG() public méthode

Return a SVG string representation of barcode.
public getBarcodeSVG ( $code, $type, $w = 2, $h = 30, $color = 'black' ) : string
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
$w (int) Minimum width of a single bar in user units.
$h (int) Height of barcode in user units.
$color (string) Foreground color (in SVG format) for bar elements (background is transparent).
Résultat string SVG code.

hex_to_dec() protected méthode

(requires PHP bcmath extension)
protected hex_to_dec ( $hex ) : string
$hex (string) hexadecimal number to convert specified as a string
Résultat string hexadecimal representation

imb_crc11fcs() protected méthode

Intelligent Mail Barcode calculation of Frame Check Sequence
protected imb_crc11fcs ( $code_arr ) : integer
$code_arr (string) array of hexadecimal values (13 bytes holding 102 bits right justified).
Résultat integer 11 bit Frame Check Sequence as integer (decimal base)

imb_reverse_us() protected méthode

Reverse unsigned short value
protected imb_reverse_us ( $num ) : integer
$num (int) value to reversr
Résultat integer reversed value

imb_tables() protected méthode

generate Nof13 tables used for Intelligent Mail Barcode
protected imb_tables ( $n, $size ) : array
$n (int) is the type of table: 2 for 2of13 table, 5 for 5of13table
$size (int) size of table (78 for n=2 and 1287 for n=5)
Résultat array requested table

setBarcode() protected méthode

Set the barcode.
protected setBarcode ( $code, $type ) : array
$code (string) code to print
$type (string) type of barcode:
  • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
  • 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
  • C128A : CODE 128 A
  • C128B : CODE 128 B
  • C128C : CODE 128 C
  • EAN2 : 2-Digits UPC-Based Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • EAN8 : EAN 8
  • EAN13 : EAN 13
  • UPCA : UPC-A
  • UPCE : UPC-E
  • MSI : MSI (Variation of Plessey code)
  • MSI+ : MSI + CHECKSUM (modulo 11)
  • POSTNET : POSTNET
  • PLANET : PLANET
  • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
  • KIX : KIX (Klant index - Customer index)
  • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
  • CODABAR : CODABAR
  • CODE11 : CODE 11
  • PHARMA : PHARMACODE
  • PHARMA2T : PHARMACODE TWO-TRACKS
Résultat array barcode array

setStorPath() public méthode

public setStorPath ( $path )

upce2a() protected méthode

Convert UPC-E to UPC-A
protected upce2a ( $code ) : string
$code (string) code to represent.
Résultat string upc-a value of upc-e

Property Details

$barcode_array protected_oe property

Array representation of barcode.
protected $barcode_array

$store_path protected_oe property

path to save png in getBarcodePNGPath
protected $store_path
Résultat