承接 inacho/php-credit-card-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

inacho/php-credit-card-validator

最新稳定版本:1.0.2

Composer 安装命令:

composer require inacho/php-credit-card-validator

包简介

Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date

README 文档

README

Build Status Coverage Status Latest Stable Version Total Downloads

Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date.

Installation

Require the package in composer.json

"require": {
    "inacho/php-credit-card-validator": "1.*"
},

If you are using Laravel, add an alias in config/app.php

'aliases' => array(

    'App'             => 'Illuminate\Support\Facades\App',
    ...
    'View'            => 'Illuminate\Support\Facades\View',

    'CreditCard'      => 'Inacho\CreditCard',

),

Usage

Validate a card number knowing the type:

$card = CreditCard::validCreditCard('5500005555555559', 'mastercard');
print_r($card);

Output:

Array
(
    [valid] => 1
    [number] => 5500005555555559
    [type] => mastercard
)

Validate a card number and return the type:

$card = CreditCard::validCreditCard('371449635398431');
print_r($card);

Output:

Array
(
    [valid] => 1
    [number] => 371449635398431
    [type] => amex
)

Validate the CVC

$validCvc = CreditCard::validCvc('234', 'visa');
var_dump($validCvc);

Output:

bool(true)

Validate the expiration date

$validDate = CreditCard::validDate('2013', '07'); // past date
var_dump($validDate);

Output:

bool(false)

Tests

Execute the following command to run the unit tests:

vendor/bin/phpunit

统计信息

  • 总下载量: 1.38M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 219
  • 点击次数: 1
  • 依赖项目数: 10
  • 推荐数: 0

GitHub 信息

  • Stars: 207
  • Watchers: 21
  • Forks: 105
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-27