定制 rocketfellows/no-vat-format-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rocketfellows/no-vat-format-validator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require rocketfellows/no-vat-format-validator

包简介

README 文档

README

Code Coverage Badge

This component provides Norway vat number format validator.

Implementation of interface rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidatorInterface

Depends on https://github.com/rocketfellows/country-vat-format-validator-interface

Vat number validation description

The technical construction of the number specifies a modulus 11 check digit at the end. The weighting factors are 3, 2, 7, 6, 5, 4, 3, 2 calculated from the first digit. The digits are thus multiplied by the weighting factors and the product sum divided by 11. The leftover from the division is subtracted by 11 and the result becomes the MOD11 checksum digit.

Installation

composer require rocketfellows/no-vat-format-validator

Usage example

Valid Norway vat number (valid expected format and checksum digit):

$validator = new NOVatFormatValidator();
$validator->isValid('NO234154877MVA');
$validator->isValid('NO234154877');
$validator->isValid('234154877MVA');
$validator->isValid('234154877');

Returns:

true
true
true
true

Invalid Norway vat number (invalid format or checksum digit):

$validator = new NOVatFormatValidator();
$validator->isValid('DE234154877MVA'); // invalid format
$validator->isValid('DE234154877'); // invalid format
$validator->isValid('NO234154879MVA'); // invalid checksum digit
$validator->isValid('NO234154879'); // invalid checksum digit
$validator->isValid('234154879'); // invalid checksum digit
$validator->isValid('');
false
false
false
false
false
false

Contributing

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-30