PHP code example of avto-dev / identity-laravel

1. Go to this page and download the library: Download avto-dev/identity-laravel 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/ */

    

avto-dev / identity-laravel example snippets


use AvtoDev\IDEntity\IDEntity;

IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_VIN); // true
IDEntity::is('A123AA177', IDEntity::ID_TYPE_VIN); // false

IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_GRZ); // false
IDEntity::is('A123AA177', IDEntity::ID_TYPE_GRZ); // true

IDEntity::is('14:36:102034:2256', IDEntity::ID_TYPE_CADASTRAL_NUMBER); // true
IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_CADASTRAL_NUMBER); // false

$valid_vin = IDEntity::make('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_VIN);
$valid_vin->isValid(); // true

$invalid_vin = IDEntity::make('SOME INVALID', IDEntity::ID_TYPE_VIN);
$invalid_vin->isValid(); // false

use AvtoDev\IDEntity\IDEntity;
use AvtoDev\IDEntity\Types\IDEntityCadastralNumber;

$vin = IDEntity::make('JF1SJ5LC5DG048667');
$vin->getType();  // 'VIN'
$vin->getValue(); // 'JF1SJ5LC5DG048667'
$vin->isValid();  // true
\get_class($vin); // 'AvtoDev\IDEntity\Types\IDEntityVin'

$cadastral_number = new IDEntityCadastralNumber('10:01:0030104:691');
$cadastral_number->getType(); // 'CADNUM'
$cadastral_number->isValid(); // true

use AvtoDev\IDEntity\IDEntity;
use AvtoDev\IDEntity\Types\IDEntityVin;

$vin = new IDEntityVin(' jf1SJ5LC5DG048 667');
$vin->getValue(); // 'JF1SJ5LC5DG048667'

IDEntity::make('  a123аY777', IDEntity::ID_TYPE_GRZ)->getValue(); // 'А123АУ777'



use AvtoDev\IDEntity\Types\IDEntityVin;

$vin = IDEntityVin::make('JF1SJ5LC5DG048667');
$vin->getMaskedValue(2, 4);      // JF***********8667
$vin->getMaskedValue(4, 2, '_'); // JF1S___________67