GTIN Rule

Validate a Global Trade Item Number

117k Downloads / Month

Open Source MIT License

public Intervention\Validation\Rules\Gtin::__construct(?int $length = null)

Checks for a valid Global Trade Item Number.

Parameters

length (optional)

Optional integer length to check only for certain types (GTIN-8, GTIN-12, GTIN-13 or GTIN-14).

Example

use Intervention\Validation\Rules\Gtin;

$validator = Validator::make($request->all(), [
    'attribute-key' => new Gtin(14),
]);
Edit