chrsc/luhn-algorithm
Composer 安装命令:
composer require chrsc/luhn-algorithm
包简介
Validate and create credit/bank/loyalty card numbers
README 文档
README
I created this as a utility class that will be used to validate card numbers, this works for credit card numbers, bank accounts, loyalty card numbers, and all other card numbers that follow the modulus 10 formula.
Other uses: Validate Canadian SIN / Greek SSN / Israel ID numbers, NPI numbers for American health care, IMEI numbers.
This could not have been created without Hans Peter Luhn's Algorithm.
Validate numbers
<?php $number = 123456; $luhn = new LuhnAlgorithm; if($luhn->validate($number)) { // number passes validation } else { // number does not pass validation }
Create numbers
<?php $luhn = new LuhnAlgorithm; $length = 16; $startswith = 4444; $cardnumber = $luhn->create($length, $startswith); // $cardnumber is now a valid card number that can be used or assigned
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-11