nekoos / credit-card-validator
Validates popular debit and credit cards numbers.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/nekoos/credit-card-validator
Requires
- php: >=5.6
- inacho/php-credit-card-validator: ^1.0
This package is auto-updated.
Last update: 2025-10-10 04:38:17 UTC
README
franchises
    visa
    mastercard
    amex
    dinersclub
    discover
    unionpay
    jcb
    visaelectron
    maestro
    forbrugsforeningen
    dankort
Available methods
Validate a card number and return the type, state and number:
$card = NekoOs\Validator\Support\Facades\CreditCard::isValidNumber('371449635398431'); print_r($card);
Result:
Array
(
    [valid] =>  (bool true or false)
    [number] => 371449635398431
    [type] => mastercard
)
Also is possible Validate a card number knowing the type (franchise): (Optional)
$card = NekoOs\Validator\Support\Facades\CreditCard::isValidNumber('371449635398431', 'mastercard'); print_r($card);
Result:
Array
(
    [valid] => (bool true or false)
    [number] => 371449635398431
    [type] => mastercard
)
Validate the expiration date
$validDate = NekoOs\Validator\Support\Facades\CreditCard::isValidDate('2024-04'); var_dump($validDate);
Result:
 bool (true or false)
Validate the CVC
$validCvc = NekoOs\Validator\Support\Facades\CreditCard::isValidCvc(234, 'visa'); var_dump($validCvc);
Result:
 bool (true or false)