PHP code example of stwon / covpasscheck-php
1. Go to this page and download the library: Download stwon/covpasscheck-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/ */
stwon / covpasscheck-php example snippets
$trustStore = new FileTrustStore('./certs.json');
$check = new CovPassCheck($trustStore);
try {
// This is the scanned QR code content ↓
$certificate = $check->readCertificate('HC1:...');
$subject = $certificate->getSubject();
if ($certificate->isCovered(Target::COVID19, HealthCertificate::TYPE_VACCINATION | HealthCertificate::TYPE_RECOVERY)) {
$this->line($subject->getFirstName() . ' does conform to 2G rules.');
} else {
$this->line($subject->getFirstName() . ' does not conform to 2G rules.');
}
} catch (InvalidSignatureException $exception) {
// oh noo
}
shell
composer