PHP code example of juststeveking / gtin-php

1. Go to this page and download the library: Download juststeveking/gtin-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juststeveking / gtin-php example snippets


use JustSteveKing\GtinPHP\Gtin;

$correct = 614141999996;
$valid = Gtin::length($correct); // returns true

$incorrect = 123456;
$failed = Gtin::length($incorrect); // returns false

use JustSteveKing\GtinPHP\Gtin;

$correct = 614141999996;
$valid = Gtin::integer($correct); // returns true

$incorrect = '614141999996';
$failed = Gtin::integer($incorrect); // returns false

use JustSteveKing\GtinPHP\Gtin;

$correct = 614141999996;
$valid = Gtin::inspect($correct); // returns true

$incorrect = 123456789;
$failed = Gtin::inspect($incorrect); // returns false

use JustSteveKing\GtinPHP\Gtin;

$correct = 614141999996;
$valid = Gtin::validate($correct); // returns true

$incorrect = 123456789;
$failed = Gtin::validate($incorrect); // returns false

// using the class directly
public function rules()
{
    return [
        'gtin' => [
            '

// using the registered macro
public function rules()
{
    return [
        'gtin' => [
            '
bash
composer