Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Handy utiility to generate nice GS1-128 barcodes

License

NotificationsYou must be signed in to change notification settings

ayeo/gs1_128

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The library generates GS1 barcode. Currently supported formats: GS1 128.

Install

Note that library requires both GD and Free Type extensions installed

composer require ayeo/gs1_barcode:1.0.4

Usage

The simplest example:

useAyeo\Barcode;$builder =newBarcode\Builder();$builder->output('(10)123456(400)11');

This will generate png image using black and white and default font

barcode

Custom barcode:

useAyeo\Barcode;$builder =newBarcode\Builder();$builder->setBarcodeType('gs1-128');$builder->setFilename('barcode.png');$builder->setImageFormat('png');$builder->setWidth(500);$builder->setHeight(150);$builder->setFontPath('FreeSans.ttf');$builder->setFontSize(15);$builder->setBackgroundColor(255,255,255);$builder->setPaintColor(0,0,0);

Finally, you can use the output method to stream the image directly to the web browser.

$builder->output('(10)123456(400)11');

If you want to save the image file, you can use the saveImage method instead.

$builder->saveImage('(10)123456(400)11');

Both output() and saveImage() methods has additional boolean parameters to determine if label should be included onthe print. Default value is true.

$builder->output('(10)123456(400)11',$withLabel =false);$builder->saveImage('(10)123456(400)11',$withLabel =false);

Actually generate the same barcode because all params all set to default values. This shows onlyavailable settings

Fluent interface is welcome

useAyeo\Barcode;Barcode\Builder::build()->setWidth(600)->setBackgroundColor(100,100,100)->output('(10)123456(400)11');

Additional info

  • Supported image formats: png, jpg
  • Barcode must be valid GS1 barcode

Contributing

Everyone is welcome, feel free to join. There is Dockerfile included for ease of developemnt. The image consist ofphp5.6 with GD and FreeType extensions. It also contains composer and xdebug. To build the image locally use

docker build -t php-gs1 .

Supported identifiers

The goal is to support all existing gs1 application identifiers but at the moment I have addedonly those I needed.Feel free to add or request some. Full list ishere

CodeNameMin lengthMax length
00Serial Shipping Container Code (SSCC-18)1818
01Global Trade Item Number (GTIN)1414
02GTIN of Contained Trade Items1414
10Batch or Lot Number120
11Production Date66
12Due Date66
13Packaging Date66
15Best Before Date66
16Sell By Date66
17Expiration Date66
20Internal Product Variant22
21Serial Number120
22Consumer Product Variant120
235Third Party Controlled, Serialised Extension of GTIN (TPX)128
240Additional Item Identification130
241Customer Part Number130
242Made-to-Order Variation Number16
243Packaging Comnponent Number120
250Second Serial Number130
251Reference to Source Entity130
253Global Document Type Identifier (GDTI)1430
254GLN Extension Component120
255Global Coupon Number (GCN)1425
30Variable Count of Items (variable measure trade item)18
310yNet Weight in kilograms (variable measure trade item)66
311yLength or 1st Dimension, in meters (variable measure trade item)66
312yWidth, Diameter, or 2nd Dimension, in meters (variable measure trade item)66
313yDepth, Thickness, Height, or 3rd Dimension, in meters (variable measure trade item)66
314yArea, in square meters (variable measure trade item)66
315yNet Volume, in liters (variable measure trade item)66
316yNet Volume, in cubic meters (variable measure trade item)66
320yNet Weight, in pounds (variable measure trade item)66
321yLength or 1st Dimension, in inches (variable measure trade item)66
322yLength or 1st Dimension, in feet (variable measure trade item)66
323yLength, 1st Dimension, in yards (variable measure trade item)66
324yWidth, Diameter, or 2nd Dimension, in inches (variable measure trade item)66
325yWidth, Diameter, or 2nd Dimension, in feet (variable measure trade item)66
326yWidth, Diameter, or 2nd Dimension, in yards (variable measure trade item)66
327yDepth, Thickness, Height, or 3rd Dimension, in inches (variable measure trade item)66
328yDepth, Thickness, Height, or 3rd Dimension, in feet (variable measure trade item)66
329yDepth, Thickness, Height, or 3rd Dimension, in yards (variable measure trade item)66
330yLogistic Weight, in kilograms66
331yLength, or 1st Dimension, in meters66
332yWidth, Diameter, or 2nd Dimension, in meters66
333yDepth, Thickness, Height, or 3rd Dimension, in meters66
334yArea, in square meters66
335yLogistic Volume, in liters66
336yLogistic Volume, in cubic meters66
337yKilograms per square meter66
340yLogistic Weight, in pounds66
341yLength or 1st Dimension, in inches66
342yLength or 1st Dimension, in feet66
343yContainer Length/1st Dimension in, in yards66
344yWidth, Diameter, or 2nd Dimension, in inches66
345yWidth, Diameter, or 2nd Dimension, in feet66
346yWidth, Diameter, or 2nd Dimension, in yards66
347yDepth, Thickness, Height, or 3rd Dimension, in inches66
348yDepth, Thickness, Height, or 3rd Dimension, in feet66
349yDepth, Thickness, Height, 3rd Dimension, in yards66
350yArea, in square inches (variable measure trade item)66
351yArea, in square feet (variable measure trade item)66
352yArea, in square yards (variable measure trade item)66
353yArea, in square inches66
354yArea, in square feet66
355yArea, in square yards66
356yNet Weight, in troy ounces (variable measure trade item)66
357yNet Weight or volume, in ounces (variable measure trade item)66
360yNet Volume, in quarts (variable measure trade item)66
361yNet Volume, in U.S. gallons (variable measure trade item)66
362yLogistic Volume, in quarts66
363yLogistic Volume, in U.S. gallons66
364yNet Volume, in cubic inches (variable measure trade item)66
365yNet Volume, in cubic feet (variable measure trade item)66
366yNet Volume, in cubic yards (variable measure trade item)66
367yLogistic Volume, in cubic inches66
368yLogistic Volume, in cubic feet66
369yLogistic Volume, in cubic yards66
37Count of trade items18
390yApplicable Amount Payable or Coupon Value, in local currency115
391yApplicable Amount Payable with ISO Currency Code418
392yApplicable Amount Payable, Single Monetary Area (variable measure trade item)115
393yApplicable Amount Payable With ISO Currency Code (variable measure trade item)418
394yPercentage Discount of a Coupon44
395yAmount Payable per unit of measure single monetary area (variable measure trade item)66
400Customer's Purchase Order Number130
401Global Identification Number for Consignment (GINC)130
402Global Shipment Identification Number (GSIN)1717
403Routing Code130
410Ship To/Deliver To Global Location Number1313
411Bill To/Invoice To Global Location Number1313
412Purchased From Global Location Number1313
413Ship For/Deliver For/Forward To Global Location Number1313
414Identification of a Physical Location - Global Location Number1313
415Global Location Number of The Invoicing Party1313
416Global Location Number of The Production or Service Location1313
417Party GLN1313
420Ship To/Deliver To Postal Code Within a Single Postal Authority120
421Ship To/Deliver To Postal Code With ISO Country Code412
422Country of Origin of a Trade Item33
423Country of Initial Processing315
424Country of Processing33
425Country of Disassembly33
426Country Covering Full Process Chain33
427Country Subdivision of Origin13
4300Ship-to / Deliver-to company name135
4301Ship-to / Deliver-to contact135
4302Ship-to / Deliver-to address line 1170
4303Ship-to / Deliver-to address line 2170
4304Ship-to / Deliver-to suburb170
4305Ship-to / Deliver-to locality170
4306Ship-to / Deliver-to region170
4307Ship-to / Deliver-to country code22
4308Ship-to / Deliver-to telephone number130
4310Return-to company name135
4311Return-to contact135
4312Return-to address line 1170
4313Return-to address line 2170
4314Return-to suburb170
4315Return-to locality170
4316Return-to region170
4317Return-to country code22
4318Return-to postal code120
4319Return-to telephone number130
4320Service code description135
4321Dangerous goods flag11
4322Authority to leave11
4323Signature required flag11
4324Not before delivery date time1010
4325Not after delivery date time1010
4326Release date66
7001NATO Stock Number (NSN)1313
7002UN/ECE Meat Carcasses and Cuts Classification130
7003Expiration Date and Time1010
7004Active Potency14
7005Catch Area112
7006First Freeze Date66
7007Harvest Date612
7008Species For Fishery Purposes13
7009Fishing Gear Type110
7010Production Method12
7020Refurbishment Lot ID120
7021Functional Status120
7022Revision Status120
7023Global Individual Asset Identifier (GIAI) of an Assembly130
703yNumber of Processor with ISO Country Code330
7040GS1 UIC with Extension 1 and Importer index44
710National Healthcare Reimbursement Number (NHRN) - Germany PZN120
711National Healthcare Reimbursement Number (NHRN) - France CIP120
712National Healthcare Reimbursement Number (NHRN) - Spain CN120
713National Healthcare Reimbursement Number (NHRN) - Brasil DRN120
714National Healthcare Reimbursement Number (NHRN) - Portugal AIM120
723yCertification reference230
7240Protocol ID120
8001Roll Products - Width/Length/Core Diameter/Direction/Splices1414
8002Cellular Mobile Telphone Identifier120
8003Global Returnable Asset Identifier (GRAI)1530
8004Global Individual Asset Identifier (GIAI)130
8005Price per Unit of Measure66
8006Identification of an Individual Trade Item Piece1818
8007International Bank Account Number (IBAN)134
8008Date and Time of Production812
8009Optically Readable Sensor Indicator150
8010Component/Part Identifier (CPID)130
8011Component/Part Identifier Serial Number (CPID Serial)112
8012Software Version120
8013Global Model Number (GMN)130
8017Global Service Relation Number to Identify the Relationship Between an Organisation Offering Services and the Provider of Services1818
8018Global Service Relation Number to Identify the Relationship Between an Organisation Offering Services and the Recipient of Services1818
8019Service Relation Instance Number (SRIN)110
8020Payment Slip Reference Number125
8026Identification of pieces of a trade item (ITIP) contained in a logistic unit1818
8110Coupon Code Identification for Use in North America170
8111Loyalty Points of a Coupon44
8112Paperless Coupon Code Identification for Use in North America (AI 8112)170
8200Extended Packaging URL170
90Information Mutually Agreed Between Trading Partners130
91Internal Company Codes190
92Internal Company Codes190
93Internal Company Codes190
94Internal Company Codes190
95Internal Company Codes190
96Internal Company Codes190
97Internal Company Codes190
98Internal Company Codes190
99Internal Company Codes190

[8]ページ先頭

©2009-2025 Movatter.jp