- 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.