API reference / Quittio \ Country \ DE \ Support
TaxNumber
final readonly class in quittio/country-de
Quittio\Country\DE\Support\TaxNumber · Source
German tax number (Steuernummer, BT-32) as described in "Prüfung der Steuer- und Steueridentifikationsnummer" of the Bayerisches Landesamt für Steuern (ELSTER, as of 2 September 2026): the 13-digit ELSTER format FFFF0BBBUUUUP (NRW: FFFF0BBBBUUUP), the 12-digit federal format without the 0, and the notation of the federal states on tax notices (e.g. 181/815/08155 in Bavaria, 133/8150/8159 in NRW).
A number is valid when it passes the formal checks and the check digit procedure of its state: the modified 11 procedure (Rhineland-Palatinate), the 2 procedure (Baden-Württemberg, Hesse, Schleswig-Holstein) or the 11 procedure with the factors of the state (all others, Berlin with the variants A and B). A state notation without the state is checked against every state that uses it; as several states share a notation (e.g. FF/BBB/UUUUP), parse() then returns the first valid interpretation unless the state is given. Whether the tax office exists (ELSTER list of tax offices) is not checked.
Constants#
| Constant | Value | Description |
|---|---|---|
STATE_PREFIXES | ['10' => 'SL', '11' => 'BE', '21' => 'SH', '22' => 'HH', '23' => 'NI', '24' => 'HB', '26' => 'HE', '27' => 'RP', '28' => 'BW', '30' => 'BB', '31' => 'ST', '32' … | First digits of the ELSTER format (Bundesfinanzamtsnummer) => state (ISO 3166-2:DE). |
Methods#
| Method | Description |
|---|---|
->formatted() | Notation on tax notices, e.g. 181/815/08155 or 133/8150/8159. |
::looksLikeVatId() | A VAT identification number (DE + 9 digits) given as tax number. |
::parse() | The valid tax number in any notation, or null when it is invalid or cannot be checked. |
::validate() | true = valid, false = invalid, null = plausible but not checkable (a Bavarian notation without the tax office number, BBB/UUUUP). |
formatted()#
public function formatted(): stringNotation on tax notices, e.g. 181/815/08155 or 133/8150/8159.
- Returns
string
looksLikeVatId()#
public static function looksLikeVatId(string $value): boolA VAT identification number (DE + 9 digits) given as tax number.
| Parameter | Type | Description |
|---|---|---|
$value | string |
- Returns
bool
parse()#
public static function parse(string $value, string|null $state = null): ?selfThe valid tax number in any notation, or null when it is invalid or cannot be checked.
| Parameter | Type | Description |
|---|---|---|
$value | string | |
$state | string|null = null | ISO 3166-2:DE code (e.g. BY) to read a state notation |
- Returns
?self
validate()#
public static function validate(string $value, ?string $state = null): ?booltrue = valid, false = invalid, null = plausible but not checkable (a Bavarian notation without the tax office number, BBB/UUUUP).
| Parameter | Type | Description |
|---|---|---|
$value | string | |
$state | ?string = null |
- Returns
?bool