定制 tdely/luhn 二次开发

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

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

tdely/luhn

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tdely/luhn

包简介

PHP implementation of the Luhn algorithm.

README 文档

README

PHP implementation of the Luhn algorithm. Commonly used in identification numbers, including IMEI and credit card numbers.

Unlike some implementations this one handles both odd and even number of digits.

Example

<?php

// Preferably autoload instead of using require
require 'src/Luhn.php';
use Tdely\Luhn\Luhn;

$original = 82356937851;

// Calculate check digit
var_dump(Luhn::checksum($original));  // int(1)

// Calculate and add check digit to number
$checksum = Luhn::create($original);
var_dump($checksum);                  // string(12) "823569378511"

// Validate numbers
var_dump(Luhn::isValid($original));   // bool(false)
var_dump(Luhn::isValid($checksum));   // bool(true)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2018-10-11