PHPackages                             ayeo/gs1\_barcode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ayeo/gs1\_barcode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ayeo/gs1\_barcode
=================

Generate GS1-128 standard barcode

1.0.4(4y ago)52112.1k↓17.4%32[2 issues](https://github.com/ayeo/gs1_128/issues)MITPHPPHP &gt;=5.4.0CI failing

Since Oct 2Pushed 2y ago4 watchersCompare

[ Source](https://github.com/ayeo/gs1_128)[ Packagist](https://packagist.org/packages/ayeo/gs1_barcode)[ RSS](/packages/ayeo-gs1-barcode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (7)Used By (0)

GS1 barcode generator
=====================

[](#gs1-barcode-generator)

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

Install
-------

[](#install)

Note that library requires both GD and Free Type extensions installed

```
composer require ayeo/gs1_barcode:1.0.4

```

Usage
-----

[](#usage)

The simplest example:

```
use Ayeo\Barcode;

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

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

[![barcode](https://camo.githubusercontent.com/fcf77e593413594ddc875d059125f09aaa15d81b8caaa0d698899cbd2a52c543/687474703a2f2f712e692d73797374656d732e706c2f66696c652f66613836393337352e706e67 "Generated barcode")](https://camo.githubusercontent.com/fcf77e593413594ddc875d059125f09aaa15d81b8caaa0d698899cbd2a52c543/687474703a2f2f712e692d73797374656d732e706c2f66696c652f66613836393337352e706e67)

Custom barcode:

```
use Ayeo\Barcode;

$builder = new Barcode\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 on the 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 only available settings

Fluent interface is welcome

```
use Ayeo\Barcode;

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

Additional info
---------------

[](#additional-info)

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

Contributing
------------

[](#contributing)

Everyone is welcome, feel free to join. There is Dockerfile included for ease of developemnt. The image consist of php5.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
---------------------

[](#supported-identifiers)

The goal is to support all existing gs1 application identifiers but at the moment I have added only those I needed. Feel free to add or request some. Full list is [here](http://www.databar-barcode.info/application-identifiers)

CodeNameMin lengthMax length00Serial Shipping Container Code (SSCC-18)181801Global Trade Item Number (GTIN)141402GTIN of Contained Trade Items141410Batch or Lot Number12011Production Date6612Due Date6613Packaging Date6615Best Before Date6616Sell By Date6617Expiration Date6620Internal Product Variant2221Serial Number12022Consumer Product Variant120235Third Party Controlled, Serialised Extension of GTIN (TPX)128240Additional Item Identification130241Customer Part Number130242Made-to-Order Variation Number16243Packaging Comnponent Number120250Second Serial Number130251Reference to Source Entity130253Global Document Type Identifier (GDTI)1430254GLN Extension Component120255Global Coupon Number (GCN)142530Variable Count of Items (variable measure trade item)18310yNet Weight in kilograms (variable measure trade item)66311yLength or 1st Dimension, in meters (variable measure trade item)66312yWidth, Diameter, or 2nd Dimension, in meters (variable measure trade item)66313yDepth, Thickness, Height, or 3rd Dimension, in meters (variable measure trade item)66314yArea, in square meters (variable measure trade item)66315yNet Volume, in liters (variable measure trade item)66316yNet Volume, in cubic meters (variable measure trade item)66320yNet Weight, in pounds (variable measure trade item)66321yLength or 1st Dimension, in inches (variable measure trade item)66322yLength or 1st Dimension, in feet (variable measure trade item)66323yLength, 1st Dimension, in yards (variable measure trade item)66324yWidth, Diameter, or 2nd Dimension, in inches (variable measure trade item)66325yWidth, Diameter, or 2nd Dimension, in feet (variable measure trade item)66326yWidth, Diameter, or 2nd Dimension, in yards (variable measure trade item)66327yDepth, Thickness, Height, or 3rd Dimension, in inches (variable measure trade item)66328yDepth, Thickness, Height, or 3rd Dimension, in feet (variable measure trade item)66329yDepth, Thickness, Height, or 3rd Dimension, in yards (variable measure trade item)66330yLogistic Weight, in kilograms66331yLength, or 1st Dimension, in meters66332yWidth, Diameter, or 2nd Dimension, in meters66333yDepth, Thickness, Height, or 3rd Dimension, in meters66334yArea, in square meters66335yLogistic Volume, in liters66336yLogistic Volume, in cubic meters66337yKilograms per square meter66340yLogistic Weight, in pounds66341yLength or 1st Dimension, in inches66342yLength or 1st Dimension, in feet66343yContainer Length/1st Dimension in, in yards66344yWidth, Diameter, or 2nd Dimension, in inches66345yWidth, Diameter, or 2nd Dimension, in feet66346yWidth, Diameter, or 2nd Dimension, in yards66347yDepth, Thickness, Height, or 3rd Dimension, in inches66348yDepth, Thickness, Height, or 3rd Dimension, in feet66349yDepth, Thickness, Height, 3rd Dimension, in yards66350yArea, in square inches (variable measure trade item)66351yArea, in square feet (variable measure trade item)66352yArea, in square yards (variable measure trade item)66353yArea, in square inches66354yArea, in square feet66355yArea, in square yards66356yNet Weight, in troy ounces (variable measure trade item)66357yNet Weight or volume, in ounces (variable measure trade item)66360yNet Volume, in quarts (variable measure trade item)66361yNet Volume, in U.S. gallons (variable measure trade item)66362yLogistic Volume, in quarts66363yLogistic Volume, in U.S. gallons66364yNet Volume, in cubic inches (variable measure trade item)66365yNet Volume, in cubic feet (variable measure trade item)66366yNet Volume, in cubic yards (variable measure trade item)66367yLogistic Volume, in cubic inches66368yLogistic Volume, in cubic feet66369yLogistic Volume, in cubic yards6637Count of trade items18390yApplicable Amount Payable or Coupon Value, in local currency115391yApplicable Amount Payable with ISO Currency Code418392yApplicable Amount Payable, Single Monetary Area (variable measure trade item)115393yApplicable Amount Payable With ISO Currency Code (variable measure trade item)418394yPercentage Discount of a Coupon44395yAmount Payable per unit of measure single monetary area (variable measure trade item)66400Customer's Purchase Order Number130401Global Identification Number for Consignment (GINC)130402Global Shipment Identification Number (GSIN)1717403Routing Code130410Ship To/Deliver To Global Location Number1313411Bill To/Invoice To Global Location Number1313412Purchased From Global Location Number1313413Ship For/Deliver For/Forward To Global Location Number1313414Identification of a Physical Location - Global Location Number1313415Global Location Number of The Invoicing Party1313416Global Location Number of The Production or Service Location1313417Party GLN1313420Ship To/Deliver To Postal Code Within a Single Postal Authority120421Ship To/Deliver To Postal Code With ISO Country Code412422Country of Origin of a Trade Item33423Country of Initial Processing315424Country of Processing33425Country of Disassembly33426Country Covering Full Process Chain33427Country Subdivision of Origin134300Ship-to / Deliver-to company name1354301Ship-to / Deliver-to contact1354302Ship-to / Deliver-to address line 11704303Ship-to / Deliver-to address line 21704304Ship-to / Deliver-to suburb1704305Ship-to / Deliver-to locality1704306Ship-to / Deliver-to region1704307Ship-to / Deliver-to country code224308Ship-to / Deliver-to telephone number1304310Return-to company name1354311Return-to contact1354312Return-to address line 11704313Return-to address line 21704314Return-to suburb1704315Return-to locality1704316Return-to region1704317Return-to country code224318Return-to postal code1204319Return-to telephone number1304320Service code description1354321Dangerous goods flag114322Authority to leave114323Signature required flag114324Not before delivery date time10104325Not after delivery date time10104326Release date667001NATO Stock Number (NSN)13137002UN/ECE Meat Carcasses and Cuts Classification1307003Expiration Date and Time10107004Active Potency147005Catch Area1127006First Freeze Date667007Harvest Date6127008Species For Fishery Purposes137009Fishing Gear Type1107010Production Method127020Refurbishment Lot ID1207021Functional Status1207022Revision Status1207023Global Individual Asset Identifier (GIAI) of an Assembly130703yNumber of Processor with ISO Country Code3307040GS1 UIC with Extension 1 and Importer index44710National Healthcare Reimbursement Number (NHRN) - Germany PZN120711National Healthcare Reimbursement Number (NHRN) - France CIP120712National Healthcare Reimbursement Number (NHRN) - Spain CN120713National Healthcare Reimbursement Number (NHRN) - Brasil DRN120714National Healthcare Reimbursement Number (NHRN) - Portugal AIM120723yCertification reference2307240Protocol ID1208001Roll Products - Width/Length/Core Diameter/Direction/Splices14148002Cellular Mobile Telphone Identifier1208003Global Returnable Asset Identifier (GRAI)15308004Global Individual Asset Identifier (GIAI)1308005Price per Unit of Measure668006Identification of an Individual Trade Item Piece18188007International Bank Account Number (IBAN)1348008Date and Time of Production8128009Optically Readable Sensor Indicator1508010Component/Part Identifier (CPID)1308011Component/Part Identifier Serial Number (CPID Serial)1128012Software Version1208013Global Model Number (GMN)1308017Global Service Relation Number to Identify the Relationship Between an Organisation Offering Services and the Provider of Services18188018Global Service Relation Number to Identify the Relationship Between an Organisation Offering Services and the Recipient of Services18188019Service Relation Instance Number (SRIN)1108020Payment Slip Reference Number1258026Identification of pieces of a trade item (ITIP) contained in a logistic unit18188110Coupon Code Identification for Use in North America1708111Loyalty Points of a Coupon448112Paperless Coupon Code Identification for Use in North America (AI 8112)1708200Extended Packaging URL17090Information Mutually Agreed Between Trading Partners13091Internal Company Codes19092Internal Company Codes19093Internal Company Codes19094Internal Company Codes19095Internal Company Codes19096Internal Company Codes19097Internal Company Codes19098Internal Company Codes19099Internal Company Codes190

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~594 days

Total

5

Last Release

1502d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e19f24a709e451d9017d8748a8f42a03a3974a9ab065aeda950ec96b229d7f4?d=identicon)[ayeo](/maintainers/ayeo)

---

Top Contributors

[![ayeo](https://avatars.githubusercontent.com/u/60191?v=4)](https://github.com/ayeo "ayeo (11 commits)")[![javierportillo](https://avatars.githubusercontent.com/u/17260001?v=4)](https://github.com/javierportillo "javierportillo (8 commits)")[![Baspa](https://avatars.githubusercontent.com/u/10845460?v=4)](https://github.com/Baspa "Baspa (2 commits)")[![tannguyenit](https://avatars.githubusercontent.com/u/24540921?v=4)](https://github.com/tannguyenit "tannguyenit (1 commits)")

---

Tags

barcodebarcode-generatorgs1gs1-128gs1-barcode-generatorgs1-databarbarcodegs1gs1-128

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ayeo-gs1-barcode/health.svg)

```
[![Health](https://phpackages.com/badges/ayeo-gs1-barcode/health.svg)](https://phpackages.com/packages/ayeo-gs1-barcode)
```

###  Alternatives

[mike42/escpos-php

PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers

2.7k1.9M22](/packages/mike42-escpos-php)[bitgrave/barcode-bundle

provide barcode rendering service into your Symfony2 application.

25444.0k1](/packages/bitgrave-barcode-bundle)[z38/metzli

PHP library to generate Aztec barcodes

26315.2k](/packages/z38-metzli)[barcode-bakery/barcode-1d

Generates 1D barcodes from a PHP server to a file or HTML document.

10146.1k1](/packages/barcode-bakery-barcode-1d)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
