PHP code example of nubium / covid19-vaccination-cert-validator

1. Go to this page and download the library: Download nubium/covid19-vaccination-cert-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/ */

    

nubium / covid19-vaccination-cert-validator example snippets


// read certificate
$hash = 'HC1:.....'; // HC1 code
$trustStore = new \App\TrustStore();
$certificateFactory = new \Nubium\DCCValidator\CertificateFactory($trustStore);

$certificate = $certificateFactory->create($hash);
$vaccinationEntry = $certificate->getVaccinationEntry();


// validation process
$blackListStore = new \App\BlackListStore();
$certificateValidator = new \App\CertificateValidator($blackListStore);

if ($certificateValidator->isValid($certificate) && $vaccinationEntry->isFullyVaccinated()) {
	// Certificate is valid and proves full vaccination
}