Validate credit and debit cards given their card numbers and cvc number
amiriskander/valid-credit-card is a Laravel package for validate credit and debit cards given their card numbers and cvc number.
It currently has 1 GitHub stars and 19 downloads on Packagist (latest version v1.0.1).
Install it with composer require amiriskander/valid-credit-card.
Discover more Laravel packages by amiriskander
or browse all Laravel packages to compare alternatives.
Last updated
Simple and lightweight package that validates credit cards and debit cards for popular providers.
It validates cards against their card number lengths, card number patterns, CVC length and using Luhn algorithm if it were supported by the provider.
Require the package using composer
composer require amiriskander/valid-credit-card
Or add it manually to composer.json in the list of dependencies under require
"require": {
"amiriskander/valid-credit-card": "*"
},
use AmirIskander\CreditCard\CreditCardValidator;
$cardValidator = new CreditCardValidator();
$isValid = $cardValidator->validateCreditCard('4539392426082460', '123');
var_dump($isValid);
Output:
bool(true)
Execute the below command to run the unit tests:
vendor/bin/phpunit tests