GS1-128
| Kind | Charset | Capacity | URL | Phone |
|---|---|---|---|---|
| 1D linear | GS1 AI data | AI 01, 10, 17, 21 |
No | No |
Code 128 profile for GS1 element strings. It inserts FNC1 at the start, adds group separators after variable-length AIs when needed, and keeps numeric runs compact with Code Set C.
Example
Gs1128::create('(01)09501101530003(17)260728(10)BATCH42')->render();
Usage
use Atelier\Barcode\Gs1128;
echo Gs1128::create([
['01', '09501101530003'],
['17', '260728'],
['10', 'BATCH42'],
])
->scale(2)
->height(80)
->render();
Options
| Method | Default | Description |
|---|---|---|
scale(int) |
2 |
pixels per module |
height(int) |
80 |
bar height in pixels |
margin(int) |
10 |
quiet zone, in modules |
foreground(string) |
#000000 |
bar color |
background(string) |
#ffffff |
background color |
withText(bool) |
true |
show the human-readable element string |
modules() returns the raw bar pattern. payload() returns the encoded GS1 payload and
elementString() returns the printable (AI)value form.
withText(false) drops the element string underneath. Keep it when a human has to check an expiry date or a batch number without a scanner.
Limits
- Supported AIs:
01GTIN,17expiry date,10batch/lot,21serial. - AI
01expects a valid 14-digit GTIN with check digit. - AI
17expects a valid YYMMDD date. - AI
10and21accept printable ASCII, up to 20 characters.