Skip to content

API reference / Quittio \ Country \ CH \ QrBill

QrReference

final class in quittio/country-ch

Quittio\Country\CH\QrBill\QrReference · Source

The QR reference of the Swiss QR bill: 27 digits, the last a check digit after modulo 10 recursive (Swiss Implementation Guidelines QR-bill, annex B). It goes with a QR-IBAN only.

Methods#

MethodDescription
::checkDigit()The check digit of a string of digits after modulo 10 recursive.
::format()The reference in blocks for printing: 2 digits, then blocks of 5.
::fromDigitsOf()The QR reference of the digits of $value, e.g. of an invoice number "RE-2026-0042": the digits padded with zeros to 26 and the check digit; null without digits or with more than 26.
::isValid()Whether $reference (spaces allowed) is a QR reference with a correct check digit.

checkDigit()#

public static function checkDigit(string $digits): string

static

The check digit of a string of digits after modulo 10 recursive.

ParameterTypeDescription
$digitsstring
Returns
string

format()#

public static function format(string $reference): string

static

The reference in blocks for printing: 2 digits, then blocks of 5.

ParameterTypeDescription
$referencestring
Returns
string

fromDigitsOf()#

public static function fromDigitsOf(string $value): ?string

static

The QR reference of the digits of $value, e.g. of an invoice number "RE-2026-0042": the digits padded with zeros to 26 and the check digit; null without digits or with more than 26.

ParameterTypeDescription
$valuestring
Returns
?string

isValid()#

public static function isValid(string $reference): bool

static

Whether $reference (spaces allowed) is a QR reference with a correct check digit.

ParameterTypeDescription
$referencestring
Returns
bool

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.