Download the PHP package hlavtox/qr-payment-string-generator without Composer
On this page you can find all versions of the php package hlavtox/qr-payment-string-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hlavtox/qr-payment-string-generator
More information about hlavtox/qr-payment-string-generator
Files in hlavtox/qr-payment-string-generator
Package qr-payment-string-generator
Short Description Generates Slovak PAY by square, Czech QR Platba and EPC payment strings.
License MIT
Homepage https://www.danielhlavacek.cz
Informations about the package qr-payment-string-generator
QR Payment String Generator
QR Payment String Generator is a pure-PHP library for generating the payment strings stored inside payment QR codes. It supports three formats:
- Slovak PAY by square
- Czech QR Platba (SPD 1.0)
- EPC / SEPA credit transfer QR codes
The package creates only the payment payload, not a QR image. Pass the generated string to any QR code renderer that fits your application. There are many good libraries and services available for that purpose.
The project was created because the available PHP implementations either required some external libraries to be installed in the system, required commonly blocked functions like proc_open or did not produce a scannable PAY by square code. This is dependency-free and usable anywhere.
Compatibility
- PHP 7.4 to 8.5
- No libraries, no frameworks, no extra services, no special functions
- Requires only the common
mbstringPHP extension for UTF-8 length validation
Required fields and supported data
| Format | Required fields | Practical minimum | Supported setters |
|---|---|---|---|
| Slovak PAY by square | IBAN, beneficiary name | IBAN, amount, beneficiary name, variable symbol, payment note | setBic, setCurrency, setDueDate, setVariableSymbol, setConstantSymbol, setSpecificSymbol, setOriginatorsReferenceInformation, setPaymentNote, setInvoiceId, setBeneficiaryAddressLine1, setBeneficiaryAddressLine2 |
| Czech QR Platba | IBAN | IBAN, amount, variable symbol | setAmount, setBeneficiaryName, setCurrency, setDueDate, setVariableSymbol, setConstantSymbol, setSpecificSymbol, setPaymentNote, setPaymentType |
| EPC / SEPA QR | IBAN, beneficiary name | IBAN, amount, beneficiary name, payment reference or payment note | setAmount, setBic, setPaymentNote, setOriginatorsReferenceInformation, setPurpose, setInformation |
All formats expose the same fluent API. You may call every setter on any generator; values not supported by the selected format are safely ignored.
Complete setter support matrix
| Setter | Example data | PAY by square | Czech QR Platba | EPC / SEPA |
|---|---|---|---|---|
setIban() |
'SK8075000000004022466192' |
Required | Required | Required |
setAmount() |
'125.50' |
Used if set | Used if set | Used if set |
setBeneficiaryName() |
'Example company s.r.o.' |
Required | Used if set | Required |
setBic() |
'CEKOSKBX' |
Used if set | Ignored | Used if set |
setCurrency() |
'EUR' or 'CZK' |
Used if set | Used if set | Ignored; EPC is always EUR |
setDueDate() |
'2026-08-15' |
Used if set | Used if set | Ignored |
setVariableSymbol() |
'001234' |
Used if set | Used if set | Ignored |
setConstantSymbol() |
'0558' |
Used if set | Used if set | Ignored |
setSpecificSymbol() |
'1234567890' |
Used if set | Used if set | Ignored |
setOriginatorsReferenceInformation() |
'202600123' |
Used if set | Ignored | Ignored |
setStructuredReference() |
'RF18539007547034' |
Ignored | Ignored | Used if set; payment note is ignored |
setPaymentNote() |
'Invoice 202600123' |
Used if set | Used if set | Used as unstructured remittance information |
setInvoiceId() |
'202600123' |
Used if set | Ignored | Ignored |
setBeneficiaryAddressLine1() / setBeneficiaryAddressLine2() |
'Main Street 1' |
Used if set | Ignored | Ignored |
setPaymentType() |
'IP' |
Ignored | Used if set | Ignored |
setPurpose() |
'GDDS' |
Ignored | Ignored | Used if set |
setInformation() |
'Thank you' |
Ignored | Ignored | Used if set |
[!NOTE] For EPC,
setStructuredReference()is a structured creditor reference (a structured payment reference for the recipient): a standardized machine-readable reference beginning withRF, for exampleRF18539007547034.setPaymentNote()is unstructured remittance information (a free-text payment reference for the recipient), such asInvoice 202600123. When both are set, the structured reference takes precedence and the payment note is ignored.setInformation()is beneficiary-to-originator information (a message from the recipient to the payer).
How to pass data
Pass the values in their business form. The generators normalize IBAN and BIC whitespace and letter case, validate format-specific limits, and throw InvalidArgumentException when a value is invalid.
Why is the amount a string?
Payment QR formats require an exact decimal representation with a period as the decimal separator. PHP floats cannot safely represent many decimal values: for example, 0.1 + 0.2 can internally become 0.30000000000000004. Pass an exact string such as '125.50' instead.
If your application stores money in minor units, for example 12550 cents, convert it to an exact decimal string at the application boundary before calling setAmount(). Do not pass a value formatted with a comma, currency symbol, or thousands separator.
Formatting summary
| Setter | Type | Accepted format |
|---|---|---|
setIban() |
string |
IBAN; spaces are accepted and removed. |
setBic() |
string or null |
BIC / SWIFT; spaces are accepted and removed. |
setAmount() |
string or null |
Decimal number with .; never a float. |
setBeneficiaryName() / setPaymentNote() |
string |
Plain UTF-8 text; do not URL-encode it yourself. |
setVariableSymbol() / setConstantSymbol() / setSpecificSymbol() |
string or null |
Digits only; use strings to preserve leading zeroes. |
setDueDate() |
string, DateTimeInterface, or null |
YYYY-MM-DD when passing a string. |
Install
Slovak PAY by square
Czech QR Platba
EPC / SEPA QR
Common e-commerce usage
All versions of qr-payment-string-generator with dependencies
ext-mbstring Version *