PHP code example of smhg / sepa-qr

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

    

smhg / sepa-qr example snippets


use SepaQr\SepaQr;

$sepaQr = new SepaQr();

$sepaQr
  ->setName('Name of the beneficiary')
  ->setIban('BE123456789123456789')
  ->setAmount(100) // The amount in Euro
  ->setRemittanceText('Invoice 123456789')
  ->setSize(300);

// Output to browser:
header('Content-Type: ' . $sepaQr->getContentType());
echo $sepaQr->writeString();

// Or embed as image:
echo '<img src="' . $sepaQr->writeDataUri() . '">';

// Or generate a temporary file:
$tmpFileName = tempnam('/tmp', 'prefix');
$tmpFile = fopen($tmpFileName, 'w');
fwrite($tmpFile, $sepaQr->writeString());
// ... add file to your PDF
fclose($tmpFile);
unlink($tmpFileName);