rechtlogisch/wirtschafts-id
Composer 安装命令:
composer require rechtlogisch/wirtschafts-id
包简介
Validates the German Wirtschafts-ID (Wirtschafts-Identifikationsnummer)
README 文档
README
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 as documented within the meanwhile repealed "Datenträger-Verordnung über die Abgabe Zusammenfassender Meldungen – ZMDV" dated 13.05.1993 (BGBl. I S. 736).
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, if in doubt. Some insight concerning validity might be concluded based on VIES.
Installation
You can install the package via composer:
composer require rechtlogisch/wirtschafts-id
Usage
isWirtschaftsIdValid('DE123456788'); // => true
or
use Rechtlogisch\WirtschaftsId\WirtschaftsId; (new WirtschaftsId('DE123456788')) ->validate() // ValidationResult::class ->isValid(); // => true
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).
Source: BZSt
Tip
Based on the form/dataset you might need to provide the Unterscheidungsmerkmal or not.
Examples
isWirtschaftsIdValid('DE123456788-00001'); // => true
or
use Rechtlogisch\WirtschaftsId\WirtschaftsId; (new WirtschaftsId('DE123456788-00001')) ->validate() // ValidationResult::class ->isValid(); // => true
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
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 section.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover any security-related issues, please email open-source@rechtlogisch.de instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
rechtlogisch/wirtschafts-id 适用场景与选型建议
rechtlogisch/wirtschafts-id 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「germany」 「rechtlogisch」 「wirtschafts-id」 「wirtschafts-identifikationsnummer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rechtlogisch/wirtschafts-id 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rechtlogisch/wirtschafts-id 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rechtlogisch/wirtschafts-id 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Normalize, denormalize and validate German tax numbers (Steuernummer)
Checks a VAT-ID using the eVatR REST-API of the German Federal Central Tax Office (Bundeszentralamt für Steuern, BZSt)
Validates the German Tax-ID (Steuerliche Identifikationsnummer)
Klarna integration with Magento 2
The common implementation part of my «Kassa Compleet» and «Ginger Payments» payment extensions for Magento 2
ING Kassa Compleet integration with Magento 2
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-12
