wucdbm / credit-card-guesser
A yet another credit card type guesser
Installs: 5 346
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.8
- wucdbm/php-cs-fixers: ^0.3.0
This package is auto-updated.
Last update: 2024-10-16 08:57:04 UTC
README
<?php // 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');
A word on Regex expressions
Regexes have been collected from the following libraries
Contribution
If you need another card type to be included in the standard config, please submit a PR