Downloads
Stars
Version
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