- Can I use runcom/ean-validation-bundle in a Laravel application?
- Not out of the box. Despite being listed among PHP packages, RuncomEanValidationBundle is a Symfony2 bundle: it registers a Bundle class, ships a DependencyInjection extension, and exposes validation through symfony/validator Constraint and ConstraintValidator pairs. Laravel's validator has no concept of bundles or the Symfony DI container, so composer require plus $validator->validate() will not work. The realistic path is to extract the checksum specification and rewrite it as a Laravel Rule or Validator::extend closure.
- How do I install runcom/ean-validation-bundle?
- Installation assumes Symfony: you add the package via Composer and register the bundle in your Symfony AppKernel, then use the provided constraint annotations on your entities or form data. There is no Laravel service provider, facade, or config publish step. If you are on Laravel, treat the repository as reference material for the algorithm rather than something you install.
- What license does runcom/ean-validation-bundle use, and is it safe for a commercial Laravel app?
- The package is GPL-3.0, which is copyleft and commonly considered incompatible with closed-source or SaaS-proprietary applications without a legal review. Copying the files into your own tree as a workaround does not avoid the issue, since you would be vendoring GPL code. For most commercial products this is a hard stop on direct inclusion, which is another argument for a clean-room first-party implementation of the mod-10 checksum.
- Which barcode formats does the bundle validate?
- The package description covers EAN-8, EAN-13, UPC, and GTIN, with the underlying logic being the GS1 mod-10 check digit plus length rules. Always pass codes as strings, never integers, or a value like 0123456789012 silently becomes 123456789012 and fails or passes incorrectly. Confirm the exact supported lengths against the source before relying on any format beyond EAN-8, EAN-13, and GTIN-14.
- Does the bundle actually verify the GS1 check digit, or just the format?
- Check-digit verification is the core of what it does. The GS1 mod-10 algorithm strips separators, confirms the digit count, then applies alternating x3 and x1 weights from the right and compares the computed check digit to the final digit. That is roughly 20 to 40 lines of deterministic arithmetic, which is why the package's value-add over a hand-written implementation is low.
- Is runcom/ean-validation-bundle actively maintained?
- No. It has about 6 stars, 0 dependents, and a composite health score around 0.19, which points to an effectively abandoned, low-adoption package. There is no meaningful community to catch bugs or backport fixes. Adopting it means owning the code yourself anyway, at which point writing your own rule is the lower-risk option.
- What PHP and Symfony versions does the bundle support?
- The Bundle naming and annotation-based constraint style place it in the Symfony 2.x/3.x era, which likely means PHP 5.x or 7.0 constraints in its composer.json. Those constraints will not resolve cleanly against a modern Laravel 10 or 11 stack running PHP 8.1 or newer. Check the composer.json directly if you need certainty, but assume it is not installable on current runtimes.
- How do I validate an EAN-13 code in Laravel without this bundle?
- Create a first-party rule implementing Illuminate\Contracts\Validation\Rule, or register a closure with Validator::extend in a service provider. Inside, assert the value is a string matching ^\d{13}$ (or 8 or 14 digits depending on the format), compute the GS1 mod-10 check digit with alternating weights, and compare it to the last digit. Register it in a service provider and unit test it against known-valid GS1 test vectors. This avoids the GPL-3.0 question and removes the Symfony DI dependency entirely.
- What edge cases should my EAN and GTIN validation tests cover?
- Cover all-zeros and all-nines codes, leading zeros that must survive string handling, valid and invalid lengths for EAN-8, EAN-13, and GTIN-14, and input containing spaces or hyphens that should be stripped first. Also test non-digit characters, empty strings, and single-digit truncation. Known-valid GS1 test vectors give you confidence that the weighting direction and starting position are correct.
- Are there better alternatives for barcode and GS1 validation in Laravel?
- If you only need checksum validation, a roughly 40-line custom rule is the best option and needs no dependency at all. If you need GS1 company prefix lookup, SSCC or SKU handling, or barcode image rendering, that is outside the scope of this bundle and you should evaluate a broader GS1 library. Decide based on whether your requirements stop at the check digit or extend into GS1 data semantics.