RikudouSage / QrPaymentCZ

Simple library to generate QR payment for Czech Republic
MIT License
26 stars 7 forks source link

Svg file support #49

Closed xnekv03 closed 1 year ago

xnekv03 commented 1 year ago

Do you support SVG as a qr output format? If not would it be possible to add it? Thanks

RikudouSage commented 1 year ago

Not directly, but you can make it work like this (using endroid/qr-code):

<?php

use Endroid\QrCode\QrCode;
use Endroid\QrCode\Writer\SvgWriter;
use Rikudou\CzQrPayment\QrPayment;
use Rikudou\Iban\Iban\CzechIbanAdapter;

$qrString = (new QrPayment(
    new CzechIbanAdapter(1325090010, 3030),
))
    ->setAmount(500)
    ->setInstantPayment(true)
    ->setVariableSymbol('554')
    ->getQrString()
;

$qrCode = QrCode::create($qrString);
$writer = new SvgWriter();

$result = $writer->write($qrCode)->getString(); // $result now holds the svg