PHP code example of emcvlt / documents

1. Go to this page and download the library: Download emcvlt/documents 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/ */

    

emcvlt / documents example snippets


// Aqui definimos valores fictícios, porém válidos
$number = '01.140.812/690-10';
$stateOfRegistration = 'AC';

// Verificar se uma inscrição estadual é válida
if StateRegistration::isValid($number, $stateOfRegistration) {
	echo "A inscrição estadual {$number} / {$stateOfRegistration} é válida";
} else {
	echo "A inscrição estadual {$number} / {$stateOfRegistration} não é válida. Verifique e tente novamente.";
}

// Aqui definimos valores fictícios, porém inválidos
$number = '01.140.812/690-10';
$stateOfRegistration = 'XX';

try {
	// Verificar se uma inscrição estadual é válida
	if StateRegistration::isValid($number, $stateOfRegistration) {
		echo "A inscrição estadual {$number} / {$stateOfRegistration} é válida";
	} else {
		echo "A inscrição estadual {$number} / {$stateOfRegistration} não é válida. Verifique e tente novamente.";
	}
} catch (\InvalidArgumentException $e) {
	// Aqui tratamos os casos de UF inválida
	echo 'Exceção capturada: ',  $e->getMessage(), "\n";
}