Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Gtin Php Laravel Package

juststeveking/gtin-php

Validate and work with GTIN barcodes in PHP. juststeveking/gtin-php offers a clean API for checking GTIN-8, GTIN-12, GTIN-13, and GTIN-14 codes, including check digit verification, so you can trust product identifiers across your Laravel or PHP applications.

View on GitHub
Deep Wiki
Context7

juststeveking/gtin-php is a lightweight PHP package for working with Global Trade Item Numbers (GTINs) — the identifiers behind retail barcodes such as UPC, EAN, and ISBN. It gives you a clean API to validate existing codes and generate checksums without pulling in heavy dependencies.

  • Validates GTIN-8, GTIN-12, GTIN-13, and GTIN-14 formats
  • Calculates and verifies check digits automatically
  • Framework-agnostic, usable in any PHP project
  • Simple, expressive methods with predictable boolean results
  • Easy to install via Composer

Ideal for e-commerce catalogues, inventory tools, or anywhere you need to confirm a barcode is well-formed.

Frequently asked questions about Gtin Php
How do I install juststeveking/gtin-php in a Laravel app?
Run composer require juststeveking/gtin-php in your Laravel project. There is no service provider to register and no config file to publish; the package is framework-agnostic and can be used directly in a form request, import handler, or scan-ingest endpoint. Keep the dependency behind an owned validator interface so application code does not reference the vendor namespace directly.
Does juststeveking/gtin-php support GTIN-8, GTIN-12, GTIN-13, and GTIN-14?
Yes. juststeveking/gtin-php validates GTIN-8, GTIN-12, GTIN-13, and GTIN-14 formats and verifies the GS1 Modulo-10 check digit. It is designed for format validation, not for checking GS1 registry membership or supplier ownership.
Do I need to register a service provider or publish config for this package?
No. The package ships no Laravel service provider, facade, config file, migrations, or publishable assets. That is intentional: it is a stateless arithmetic utility, so you install it with Composer and call it from the boundary of your catalogue domain.
How do I validate a GTIN check digit with juststeveking/gtin-php?
Pass the GTIN as a string to the package's validator and expect a boolean result indicating whether the format and check digit are valid. Do not pass integers from request data or database casts, because leading zeros are part of the identifier. In Laravel, validate the input as a digit-only string first, then delegate to the package behind your own GtinValidator wrapper.
Can juststeveking/gtin-php generate or calculate a GTIN check digit?
The package calculates and verifies GTIN check digits as part of its checksum handling, so you can use it when building or auditing codes. Check the README for the exact method names in your installed version. Keep checksum generation in the same adapter layer as validation so your domain does not depend on the vendor API.
Why are leading zeros important when validating GTINs in Laravel?
GTINs are identifiers, not numbers. A leading zero changes the value: 012345678905 is a valid GTIN-12, while 12345678905 is a different and invalid value. Store GTINs in string columns, use string casts and string validation rules, and have your wrapper reject anything that is not a digit-only string before delegating to the package.
Is juststeveking/gtin-php safe for production Laravel catalogue data?
Use it with discipline. The package is small, MIT licensed, and has no runtime dependencies, but the last release was January 2021 and it has little production feedback. Wrap it behind an owned GtinValidator interface, store canonical GTIN-14 strings with zero-padding, and unit test your adapter so the dependency remains replaceable.
Does juststeveking/gtin-php confirm that a GTIN is registered with GS1?
No. The validator confirms format and check digit only; it does not confirm that the GTIN is registered with GS1, that the supplier owns the company prefix, or that the product is unique in your catalogue. Avoid letting stakeholders hear validated GTIN and infer verified product data.
What Laravel and PHP versions does juststeveking/gtin-php support?
The package is framework-agnostic and declares no Laravel service provider, so there is no Laravel version constraint to satisfy. Version 1.0.1 moved illuminate/support to require-dev, which helps it resolve into Laravel apps and slim CLI images. The last release was January 2021, though, so PHP 8.2 and 8.3 compatibility is undeclared; test on your target PHP runtime and verify no Illuminate references survive at runtime.
What are alternatives to juststeveking/gtin-php for Laravel?
You can use another Composer GTIN or barcode validation package, a GS1-focused library, or a small in-house Modulo-10 validator. Because juststeveking/gtin-php is roughly 100 lines of MIT-licensed arithmetic with no runtime dependencies, vendoring or replacing it is cheap. The important design choice is the owned GtinValidator interface, which lets you swap implementations without touching catalogue code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console