PHPackages                             rechtlogisch/wirtschafts-id - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. rechtlogisch/wirtschafts-id

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

rechtlogisch/wirtschafts-id
===========================

Validates the German Wirtschafts-ID (Wirtschafts-Identifikationsnummer)

v1.1.1(8mo ago)09MITPHPPHP ^8.2CI passing

Since Nov 12Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/rechtlogisch/wirtschafts-id)[ Packagist](https://packagist.org/packages/rechtlogisch/wirtschafts-id)[ Docs](https://github.com/rechtlogisch/wirtschafts-id)[ RSS](/packages/rechtlogisch-wirtschafts-id/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

[![Recht logisch Wirtschafts-ID banner image](rechtlogisch-wirtschafts-id-banner.png)](rechtlogisch-wirtschafts-id-banner.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f2d996e6626bdfa6cbc0fed5306f49ff1f822a973b0a7e0af1fbb51ddc6409e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656368746c6f67697363682f77697274736368616674732d69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rechtlogisch/wirtschafts-id)[![Tests](https://github.com/rechtlogisch/wirtschafts-id/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/rechtlogisch/wirtschafts-id/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/5815af4526a71149bf89fb8549e2041ee79570d115ae0855fe60484a6085fa6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656368746c6f67697363682f77697274736368616674732d69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rechtlogisch/wirtschafts-id)

wirtschafts-id
==============

[](#wirtschafts-id)

> Validates the German Wirtschafts-ID (Wirtschafts-Identifikationsnummer)

Check digit (eleventh position in normalised form) is validated based on [ISO/IEC 7064, MOD 11,10](https://www.iso.org/standard/31531.html) as documented within the meanwhile repealed "Datenträger-Verordnung über die Abgabe Zusammenfassender Meldungen – ZMDV" dated 13.05.1993 ([BGBl. I S. 736](https://www.bgbl.de/xaver/bgbl/start.xav?start=%2F%2F*%5B%40attr_id%3D%27bgbl193s0726.pdf%27%5D#__bgbl__%2F%2F*%5B%40attr_id%3D%27bgbl193s0726.pdf%27%5D__1720528216746)).

Note

This package validates solely the syntax and check digit of the provided input. It does not confirm, that the provided Wirtschafts-ID was assigned to an entity. Please consult [BZSt](https://www.bzst.de/DE/Unternehmen/Identifikationsnummern/Wirtschafts-Identifikationsnummer/wirtschaftsidentifikationsnummer_node.html), if in doubt. Some insight concerning validity might be concluded based on [VIES](https://ec.europa.eu/taxation_customs/vies/).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rechtlogisch/wirtschafts-id
```

Usage
-----

[](#usage)

```
isWirtschaftsIdValid('DE123456788'); // => true
```

or

```
use Rechtlogisch\WirtschaftsId\WirtschaftsId;

(new WirtschaftsId('DE123456788'))
    ->validate() // ValidationResult::class
    ->isValid(); // => true
```

Unterscheidungsmerkmal, short: U-Merkmal
----------------------------------------

[](#unterscheidungsmerkmal-short-u-merkmal)

This package supports both validation of the Wirtschafts-ID with and without the Unterscheidungsmerkmal. It is optional information after the eleventh character and separator. It consists of a hyphen and a five-digit number.

Note

Unterscheidungsmerkmal starts at `00001` and therefore `00000` is not valid.

Tip

At first all entities will receive a Wirtschafts-ID with the Unterscheidungsmerkmal `-00001`. If needed, as of 4th quarter of 2027 each economic activity (wirtschaftliche Tätigkeit) will receive a separate Unterscheidungsmerkmal, which will be incremented by one for each economic activity and linked to a tax number of the business or the permanent establishment within the responsible tax office (cf. [bzst.de](https://www.bzst.de/DE/Unternehmen/Identifikationsnummern/Wirtschafts-Identifikationsnummer/wirtschaftsidentifikationsnummer_node.html#js-toc-entry4)).

Source: [BZSt](https://www.bzst.de/DE/Unternehmen/Identifikationsnummern/Wirtschafts-Identifikationsnummer/wirtschaftsidentifikationsnummer_node.html#js-toc-entry4)

Tip

Based on the form/dataset you might need to provide the Unterscheidungsmerkmal or not.

### Examples

[](#examples)

```
isWirtschaftsIdValid('DE123456788-00001'); // => true
```

or

```
use Rechtlogisch\WirtschaftsId\WirtschaftsId;

(new WirtschaftsId('DE123456788-00001'))
    ->validate() // ValidationResult::class
    ->isValid(); // => true
```

Validation errors
-----------------

[](#validation-errors)

You can get a list of errors explaining why the provided input is invalid. The `validate()` method returns a DTO with a `getErrors()` method.

Note

The keys of `getErrors()` hold the stringified reference to the exception class. You can check for a particular error by comparing to the ::class constant. For example: `Rechtlogisch\WirtschaftsId\Exceptions\InvalidWirtschaftsIdWithoutUnterscheidungsmerkmalLength::class`.

```
validateWirtschaftsId('DE12345678')->getErrors();
// [
//   'Rechtlogisch\WirtschaftsId\Exceptions\InvalidWirtschaftsIdWithoutUnterscheidungsmerkmalLength'
//    => 'Wirtschafts-ID must be 11 characters long. Provided Wirtschafts-ID is: 10 characters long.',
// ]
```

or

```
use Rechtlogisch\WirtschaftsId\WirtschaftsId;

(new WirtschaftsId('DE12345678'))
    ->validate()
    ->getErrors();
// [
//   'Rechtlogisch\WirtschaftsId\Exceptions\InvalidWirtschaftsIdWithoutUnterscheidungsmerkmalLength'
//    => 'Wirtschafts-ID must be 11 characters long. Provided Wirtschafts-ID is: 10 characters long.',
// ]
```

Plausibility hints
------------------

[](#plausibility-hints)

You can get a list of hints explaining why the provided input is not plausible. Hints do not change the validation result. The `validate()` method returns a DTO with a `getHints()` method.

Note

The keys of `getHints()` hold the stringified reference to the exception class. You can check for a particular error by comparing to the ::class constant. For example: `Rechtlogisch\WirtschaftsId\Exceptions\UnterscheidungsmerkmalShouldBe00001BeforeYear2027::class`.

```
validateWirtschaftsId('DE123456788-00002')->getHints();
// [
//   'Rechtlogisch\WirtschaftsId\Exceptions\UnterscheidungsmerkmalShouldBe00001BeforeYear2027'
//    => 'Unterscheidungsmerkmal (after -) is typically "00001" before year 2027.',
// ]
```

Tip

You can of course use the alternative way of validation presented in the [Usage](#usage) section.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/rechtlogisch/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Krzysztof Tomasz Zembrowski](https://github.com/zembrowski)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance65

Regular maintenance activity

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~140 days

Total

3

Last Release

266d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f60f360e9d79540ea00427585d1b0063f2c1125ef8d22be6939428ffb68ccc1?d=identicon)[rechtlogisch](/maintainers/rechtlogisch)

---

Top Contributors

[![zembrowski](https://avatars.githubusercontent.com/u/2451083?v=4)](https://github.com/zembrowski "zembrowski (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

---

Tags

germanyphpvalidatewidnrwirtschafts-idwirtschafts-identifikationsnummergermanyrechtlogischwirtschafts-idwirtschafts-identifikationsnummer

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rechtlogisch-wirtschafts-id/health.svg)

```
[![Health](https://phpackages.com/badges/rechtlogisch-wirtschafts-id/health.svg)](https://phpackages.com/packages/rechtlogisch-wirtschafts-id)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
