rechtlogisch/ust-id
最新稳定版本:v1.2.0
Composer 安装命令:
composer require rechtlogisch/ust-id
包简介
Validates the German VAT-ID (Umsatzsteuer-Identifikationsnummer)
README 文档
README
ust-id
Validates the German VAT-ID (Umsatzsteuer-Identifikationsnummer, short: USt-ID)
Check digit (last digit) 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 USt-ID was assigned to an entrepreneur. Please use the official VIES service for that.
Installation
You can install the package via composer:
composer require rechtlogisch/ust-id
Usage
isUstIdValid('DE123456788'); // => true
or
use Rechtlogisch\UstId\UstId; (new UstId('DE123456788')) ->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\UstId\Exceptions\InvalidUstIdLength::class.
validateUstId('DE12345678')->getErrors(); // [ // 'Rechtlogisch\UstId\Exceptions\InvalidUstIdLength' // => 'USt-ID must be 11 characters long. Provided USt-ID is: 10 characters long.', // ]
or
use Rechtlogisch\UstId\UstId; (new UstId('DE12345678')) ->validate() ->getErrors(); // [ // 'Rechtlogisch\UstId\Exceptions\InvalidUstIdLength' // => 'USt-ID must be 11 characters long. Provided USt-ID is: 10 characters long.', // ]
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.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-09
