wucdbm/credit-card-guesser

另一种信用卡类型猜测工具

v0.0.1 2018-08-13 22:09 UTC

This package is auto-updated.

Last update: 2024-09-16 08:39:06 UTC


README

<?php
// Guess card type
$guesser = new \Wucdbm\CreditCardGuesser\TypeGuesser();
try {
    $type = $guesser->guess('1234 1234 1234 1234');
} catch (\Wucdbm\CreditCardGuesser\Exception\UnknownCardTypeException $e) {
    // failed to match any of the built-in types
}
// Change Code for a particular card type
$guesser->setCode('Visa', 'SomeOtherCode');
// Change Regex for a particular card type
$guesser->setRegex('Visa', '/anotherRegex1234567/');
// Add another card type
$guesser->addCard('VisaElectron', 'VI', '/someRegex/');
// Remove card type
$guesser->removeCard('Visa');

关于正则表达式的说明

以下库中收集了正则表达式

贡献

如果您需要将另一种卡类型包含在标准配置中,请提交一个PR