PHP code example of herald-si / verificac19-sdk-php

1. Go to this page and download the library: Download herald-si/verificac19-sdk-php 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/ */

    

herald-si / verificac19-sdk-php example snippets




...
 Herald\GreenPass\Utils\CertificateValidator;

$gp_string = 'HC1:6BF.......';
$gp_reader = new CertificateValidator($gp_string);
$gp_info = $gp_reader->getCertificateSimple();

// Mostro la struttura dell'esito validazione
echo "<pre>" . print_r($gp_info, true) . "</pre>";
...

Herald\GreenPass\Utils\FileUtils::overrideCacheFilePath("/absolute/path/to/cache/folder");

Herald\GreenPass\Utils\FileUtils::overrideCacheFilePath("c:\path\to\cache\folder");

//aggiorna lo status dei certificati
Herald\GreenPass\Utils\UpdateService::updateCertificatesStatus();
//aggiorna la lista dei certificati
Herald\GreenPass\Utils\UpdateService::updateCertificateList();
//aggiorna le regole di validazione
Herald\GreenPass\Utils\UpdateService::updateValidationRules();
//aggiorna le liste di revoca
Herald\GreenPass\Utils\UpdateService::updateRevokeList();

Herald\GreenPass\Utils\UpdateService::updateAll();

Herald\GreenPass\Utils\EndpointService::setProxy("https://username:[email protected]:8000");

// set scan mode to BASE
$scanMode = ValidationScanMode::CLASSIC_DGP;

$gp_reader = new CertificateValidator($gp_string, $scanMode);

Herald\GreenPass\Utils\EnvConfig::enableDebugMode();
... do some test ...
Herald\GreenPass\Utils\EnvConfig::disableDebugMode();

//non viene forzato l'aggiornamento, manca debug mode
Herald\GreenPass\Utils\UpdateService::updateCertificatesStatus(true);
---
//non viene forzato l'aggiornamento, parametro force update a false
Herald\GreenPass\Utils\EnvConfig::enableDebugMode();
Herald\GreenPass\Utils\UpdateService::updateCertificatesStatus();
---
//viene forzato l'aggiornamento, non usare in produzione!
Herald\GreenPass\Utils\EnvConfig::enableDebugMode();
Herald\GreenPass\Utils\UpdateService::updateCertificatesStatus(true);