PHP validation for Romanian VAT code (Validare PHP pentru CIF/ CUI)
composer require alcea/cif
"alcea/cif": "^1.1"
<?php
# require __DIR__ . '\vendor\autoload.php';
use alcea\cif\Cif;
$cifToBeValidated = '159'; // without prefix digit (RO|R)
$cif = new Cif($cifToBeValidated);
echo "CIF {$cifToBeValidated} is " . ( $cif->isValid() ? 'valid' : 'invalid' ) . PHP_EOL;
// or
echo "CIF {$cifToBeValidated} is " . ( Cif::validate($cifToBeValidated) ? 'valid' : 'invalid' ) . PHP_EOL;
## Open an terminal and run commands:
git clone https://github.com/alceanicu/cif.git
cd cif
composer install
./vendor/bin/phpunit --bootstrap ./vendor/autoload.php --testdox
This package is licensed under the MIT license.