PHP code example of zaslat / qr-invoice

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

    

zaslat / qr-invoice example snippets




efr\QRPlatba\QRInvoice;

$qrInvoice = new QRInvoice();

$qrInvoice->setAccountIBAN('Valid-IBAN-account')
    ->setGenerateQRInvoice(true) // Generuje QR kód pro QR Platbu i QR Fakturu
    ->setVariableSymbol('2016001234')
    ->setMessage('Toto je první QR platba.')
    ->setSpecificSymbol('0308')
    ->setSpecificSymbol('1234')
    ->setCurrency('CZK') // Výchozí je CZK, lze zadat jakýkoli ISO kód měny
    ->setDueDate(new \DateTime())
    ->setSvgDimension(190); // Velikost <svg> objektu.

echo $qrInvoice->getQRCodeImage(); // Zobrazí <img> tag s kódem, viz níže  

echo QRInvoice::create('12-3456789012/0100', 987.60)
    ->setMessage('QR platba je parádní!')
    ->getQRCodeImage();

// Uloží png o velikosti 100x100 px
$qrInvoice->saveQRCodeImage("qrcode.png", "png", 100);

// Uloží svg o velikosti 100x100 px
$qrInvoice->saveQRCodeImage("qrcode.svg", "svg", 100);

// data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFAAQMAAAD3XjfpAAAA...
echo $qrInvoice->getQRCodeInstance()->writeDataUri();