PHP code example of petrknap / php-spaydqr

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

    

petrknap / php-spaydqr example snippets


use Money\Money;
use PetrKnap\SpaydQr\QrCode;
use PetrKnap\SpaydQr\Spayd;

echo '<img src="' . QrCode::asDataUri(
    Spayd::create(
        account: 'CZ7801000000000000000123',
        amount: Money::CZK(79950),
    ),
) . '">';

use Money\Money;
use PetrKnap\SpaydQr\Spayd;

Spayd::create(
    account: 'CZ7801000000000000000123',
    amount: Money::CZK(79950),
)->withVariableSymbol(20250323001);

use Money\Money;
use PetrKnap\SpaydQr\Spayd;

Spayd::create(
    account: 'CZ7801000000000000000123',
    invoice: Spayd\Sind::create(
        id: 'FA20250323001',
        issueDate: new DateTime('2025-03-23'),
        amount: Money::CZK(79950),
    ),
)->withVariableSymbol(20250323001);