samyan/bankcard-validator
最新稳定版本:1.1
Composer 安装命令:
composer require samyan/bankcard-validator
包简介
php bankcard validator
README 文档
README
Validates debit and credit cards numbers against regular expressions and Luhn algorithm for PHP 7.0+ Also validates the CVC and the expiration date. Project based on and inspired by inacho/php-credit-card-validator
Installation
Require the package in composer.json
"require": { "samyan/bankcard-validator": "1.*" },
Actual supported Bank Cards
Debit cards
- Visa Electron
- Maestro
- Forbrugsforeningen
- Dankort
Credit cards
- Visa
- Mastercard
- Amex
- Diners Club
- Discover
- UnionPay
- JCB (Japan Credit Bureau)
- Elo
- Hipercard
- Mir
- UATP (Universal Air Travel Plan)
- RuPay
Usage
Validate a card number knowing the type:
$card = BankCard::validateCardNumber('5500005555555559', 'mastercard'); print_r($card);
Output:
Array
(
[valid] => 1
[number] => 5500005555555559
[type] => mastercard
)
Validate a card number and return the type:
$card = BankCard::validateCardNumber('371449635398431'); print_r($card);
Output:
Array
(
[valid] => 1
[number] => 371449635398431
[type] => amex
)
Validate the CVC
$validCvc = BankCard::isValidCvc('234', 'visa'); var_dump($validCvc);
Output:
bool(true)
Validate the expiration date
$validDate = BankCard::isValidDate('2013', '07'); // past date var_dump($validDate);
Output:
bool(false)
统计信息
- 总下载量: 1.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-04