PHP code example of rocketfellows / no-vat-format-validator

1. Go to this page and download the library: Download rocketfellows/no-vat-format-validator 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/ */

    

rocketfellows / no-vat-format-validator example snippets


$validator = new NOVatFormatValidator();
$validator->isValid('NO234154877MVA');
$validator->isValid('NO234154877');
$validator->isValid('234154877MVA');
$validator->isValid('234154877');

$validator = new NOVatFormatValidator();
$validator->isValid('DE234154877MVA'); // invalid format
$validator->isValid('DE234154877'); // invalid format
$validator->isValid('NO234154879MVA'); // invalid checksum digit
$validator->isValid('NO234154879'); // invalid checksum digit
$validator->isValid('234154879'); // invalid checksum digit
$validator->isValid('');