Skip to content

根据银行卡号识别所属银行以及卡类型

License

Notifications You must be signed in to change notification settings

ScoLib/bankcard

Repository files navigation

bankcard

StyleCI Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

根据银行卡号识别所属银行以及卡类型
目前支持两种识别方式:阿里API和正则,默认使用阿里的API

安装

Via Composer

$ composer require scolib/bankcard

使用

$bankcard = new Sco\Bankcard\Bankcard();
//$bankcard = new Sco\Bankcard\Bankcard(new Sco\Bankcard\Providers\RegexProvider());

// 返回一个Sco\Bankcard\Info实例
// 如果未识别 抛出异常 Sco\Bankcard\Exceptions\ValidationException
$info = $bankcard->info($cardNo);

// 银行卡信息(数组)
$info->getBankInfo();

// 所属银行代号
$info->getBankCode();

// 所属银行名称
$info->getBankName();

// 所属银行icon(如果有)
$info->getBankIcon();

// 卡类型代号
$info->getCardType();

// 卡类型名称
$info->getCardTypeName();

Change log

更新日志

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email slice1213@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.