byrokrat/checkdigit 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

byrokrat/checkdigit

最新稳定版本:2.1.0

Composer 安装命令:

composer require byrokrat/checkdigit

包简介

Helper classes to calculate and validate ckecksums

README 文档

README

ABANDONED! This package is discontinued and will not be updated.

Checkdigit

Packagist Version Build Status Quality Score Scrutinizer Coverage

Helper classes to calculate and validate ckecksums.

Installation

composer require byrokrat/checkdigit

Checkdigit requires the bcmath php extension.

API

The Calculator interface defines two methods:

  • isValid(string $number): bool checks if number contains a valid check digit.
  • calculateCheckDigit(string $number): string calculates the check digit for number.

Implementations include:

  • Modulo10 and Luhn for modulo 10 check digits (Luhn is simply a shorthand for Modulo10).
  • Modulo10Gtin for modulo 10 check digits variant used in GTIN barcodes.
  • Modulo11 for modulo 11 check digits.
  • Modulo97 for modulo 97 check digits.

Usage

$luhn = new byrokrat\checkdigit\Luhn;

// outputs '1' (true)
echo $luhn->isValid('55555551');

// outputs '' (false)
echo $luhn->isValid('55555550');

// outputs '1'
echo $luhn->calculateCheckDigit('5555555');

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2015-01-26