PHP code example of thecnology / czeurqrcode

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

    

thecnology / czeurqrcode example snippets


$qr = new QrCodeGenerator();
$request = new PaymentRequest(
    amount: 100.00,
    currency: PaymentRequest::CURRENCY_CZK,
    message: 'Nejaka zprava co uvidi vlastnik uctu pri prijeti platby',
    accountNumber: '100000',
    bankCode: '2010',
    variableSymbol: '123456789',
);
header('Content-Type: image/png');
echo $qr->getQrCode(qrData: $request->getQrCodeData(), qrLabel: 'Děkujeme za zaplacení!')->getString();

$qr = new QrCodeGenerator();
$request = new PaymentRequest(
    amount: 100.00,
    currency: PaymentRequest::CURRENCY_EUR,
    message: 'Platba za sluzby',
    variableSymbol: '123456789',
    iban: 'SK6807200002891987426353',
    country: PaymentRequest::COUNTRY_SK, // klíčové: vynutí formát Pay by Square
);
header('Content-Type: image/png');
echo $qr->getQrCode(qrData: $request->getQrCodeData(), qrLabel: 'Ďakujeme!')->getString();

$qr = new QrCodeGenerator();
$request = new PaymentRequest(
    amount: 100.00,
    currency: PaymentRequest::CURRENCY_EUR,
    message: 'Nejaka zprava co uvidi vlastnik uctu pri prijeti platby',
    iban: 'CZ6500000000000000000000',
    bic: 'FIOBCZPPXXX',
    recipientName: 'Recipient name', // Pouze pro SEPA QR
);
header('Content-Type: image/png');
echo $qr->getQrCode(qrData: $request->getQrCodeData(), qrLabel: 'Děkujeme za zaplacení!')->getString();

//moznost konfigurovat vzhled QR kódu - logo
$logo = new Logo(
    path: __DIR__.'/assets/bender.png',
    resizeToWidth: 50,
    punchoutBackground: true
);
//moznost konfigurovat vzhled QR kódu
$qr = new QrCodeGenerator(
    size: 300, // Size of the QR code in pixels
    margin: 10, // Margin around the QR code
    logo: $logo, // Logo to be added to the QR code
    errorCorrectionLevel: ErrorCorrectionLevel::Low,
    roundBlockSizeMode: RoundBlockSizeMode::Margin,
    foregroundColor: new Endroid\QrCode\Color\Color(0,0,0), // Foreground color in hex format
    backgroundColor: new Endroid\QrCode\Color\Color(255,255,244), // Background color in hex format
    labelColor: new Endroid\QrCode\Color\Color(100,0,0) // Color for the label text
);