komakino/luhn 问题修复 & 功能扩展

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

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

komakino/luhn

最新稳定版本:v1.0.3

Composer 安装命令:

composer require komakino/luhn

包简介

README 文档

README

Luhn algorithm implementation for PHP. The Luhn algorithm is used in credit card numbers and national identity numbers.

Installation

To add this package as a dependency to your project, simply add a dependency on komakino/luhn to your project's composer.json file.

    {
        "require": {
            "komakino/luhn": "*"
        }
    }

Usage

use Komakino\Luhn\Luhn;

Static methods

static bool validate(string|int $number)

Validates a number.

Luhn::validate('12345678'); // returns false
Luhn::validate('87654323'); // returns true

static int calculate(string|int $partial_number)

Calculates the check digit of a number.

Luhn::calculate('1234567'); // returns 4
Luhn::calculate('8765432'); // returns 3

static string appendCheckDigit(string|int $partial_number)

Calculates the check digit and returns number with check digit appended.

Luhn::appendCheckDigit('1234567'); // returns 12345674
Luhn::appendCheckDigit('8765432'); // returns 87654323

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-01-14