PHP code example of eudiegoborgs / credit-card-pattern

1. Go to this page and download the library: Download eudiegoborgs/credit-card-pattern 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/ */

    

eudiegoborgs / credit-card-pattern example snippets


use EuDiegoBorgs\CreditCardPattern\Type\CreditCard;

$creditCard = new CreditCard('Sherlock Holmes', '02/2099', '123', '0123456789012345');

echo $creditCard->isExpired(); // false
echo (string) $creditCard->getBin(); // 012345
echo (string) $creditCard->getLastFour(); // 2345
var_dump($creditCard->toArray()); 
/**
 * Prints this data
 * [
 *      'holderName' => 'Sherlock Holmes',
 *      'validThru' => '02/2099',
 *      'cvv' => '123',
 *      'number' => '0123456789012345',
 *      'bin' => '012345',
 *      'lastFour' => '2345',
 *  ]