PHP code example of wucdbm / credit-card-guesser
1. Go to this page and download the library: Download wucdbm/credit-card-guesser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wucdbm / credit-card-guesser example snippets
// Guess card type
$guesser = new \Wucdbm\CreditCardGuesser\TypeGuesser();
try {
$type = $guesser->guess('1234 1234 1234 1234');
} catch (\Wucdbm\CreditCardGuesser\Exception\UnknownCardTypeException $e) {
// failed to match any of the built-in types
}
// Change Code for a particular card type
$guesser->setCode('Visa', 'SomeOtherCode');
// Change Regex for a particular card type
$guesser->setRegex('Visa', '/anotherRegex1234567/');
// Add another card type
$guesser->addCard('VisaElectron', 'VI', '/someRegex/');
// Remove card type
$guesser->removeCard('Visa');