rokclimb15 / virin
A PHP library for validating and parsing DoD Visual Information Record Identification Number (VIRIN).
dev-master
2025-03-13 13:19 UTC
Requires
- php: ^8.1
Requires (Dev)
- bentools/cartesian-product: ^1.4
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10
This package is not auto-updated.
Last update: 2025-03-27 13:32:40 UTC
README
A PHP library for validating and parsing DoD Visual Information Record Identification Number (VIRIN)
Usage
Validator
<?php
use Rokclimb15\Virin\Validator;
$validator = new Validator();
$isValid = $validator->validate('180201-A-AB123-1001-DE');
var_dump($isValid);
=> bool(true)
Parser
use Rokclimb15\Virin\Parser;
$parser = new Parser();
$parser->parse('180515-A-AB123-1001');
var_dump($parser->getDateTime());
=> object(DateTime)#735 (3) {
["date"]=>
string(26) "2018-05-15 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
var_dump($parser->getBranchCode());
=> string(1) "A"
var_dump($parser->getVisionIdOrDvian());
=> string(5) "AB123"
var_dump($parser->getSequence());
=> string(4) "1001"
var_dump($parser->getIso2CountryCode());
=> NULL
var_dump($parser->hasVisionId());
=> bool(true)
var_dump($parser->hasDvian());
=> bool(false)