2017 © Pedro PelĂĄez
 

library php-credit-card-validator-plus

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

image

annaghd/php-credit-card-validator-plus

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

  • Wednesday, November 1, 2017
  • by annaghd
  • Repository
  • 0 Watchers
  • 0 Stars
  • 127 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 51 Forks
  • 0 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

PHP Credit Card Validator

Build Status Coverage Status Latest Stable Version Total Downloads, (*1)

Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date., (*2)

Installation

Require the package in composer.json, (*3)

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

If you are using Laravel, add an alias in config/app.php, (*4)

'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:, (*5)

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

Validate a card number and return the type:

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

Output:, (*6)

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

Validate the CVC

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

Output:, (*7)

bool(true)

Validate the expiration date

$validMonth = CreditCard::validMonth('07'); // past date
var_dump($validMonth);

$validYear = CreditCard::validYear('2007'); // past date
var_dump($validYear);

Output:, (*8)

bool(false)

bool(false)

Tests

Execute the following command to run the unit tests:, (*9)

vendor/bin/phpunit

The Versions

01/11 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • lib-pcre >=7.3

 

The Development Requires

by Anna

laravel validator cards creditcard card credit debit creditcards cvc

03/07 2015

1.0.2

1.0.2.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • lib-pcre >=7.3

 

The Development Requires

by Ignacio de TomĂĄs

laravel validator cards creditcard card credit debit creditcards cvc

21/05 2015

1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • lib-pcre >=7.3

 

by Ignacio de TomĂĄs

laravel validator cards creditcard card credit debit creditcards cvc

27/11 2014

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • lib-pcre >=7.3

 

by Ignacio de TomĂĄs

laravel validator cards creditcard card credit debit creditcards cvc