PHP code example of causal / dgc

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

    

causal / dgc example snippets


$decoder = new \Causal\DGC\Decoder();

// The string as embedded in the QR code of the certificate (e.g., you can use https://qrafter.com/)
$input = 'HC1:NCFOXNYTSFDHJI89.O%26V$L.BUTRDUV...';

// Extract issuer, issuing date, expiring date, type of vaccine, manufacturer, etc.
$data = $decoder->decodeFromQR($input);

// Basically this returns the exact same data you read in the official Swiss app "Covid Cert"
$humanReadableData = $decoder->prettify($data);