PHP code example of clntdev / blade-payment-icons

1. Go to this page and download the library: Download clntdev/blade-payment-icons 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/ */

    

clntdev / blade-payment-icons example snippets


'default_format' => 'flat',   // Default icon format
'default_width' => 40,        // Default width in pixels (height auto-calculated)

'variants' => [
    'Hiper' => [
        'slug' => 'hiper',           // Used for SVG filename resolution
        'displayName' => 'Hiper',
        'aliases' => [],              // Optional additional aliases
    ],
],

'patterns' => [
    'full' => ['^4[0-9]{12}(?:[0-9]{3})?$'],  // Complete Visa number
    'prefix' => '^4',                            // Starts with 4
],

use Clntdev\BladePaymentIcons\CardUtilities;

$utilities = app(CardUtilities::class);

// Detect card type from number
$utilities->getCardType('4242424242424242');          // 'Visa'
$utilities->getCardType('378282246310005');            // 'AmericanExpress'
$utilities->getCardType('4242');                       // 'Visa' (partial match)

// Validate with Luhn algorithm
CardUtilities::validateCardNumber('4242424242424242'); // true

// Format with appropriate spacing
$utilities->formatCardNumber('4242424242424242');      // '4242 4242 4242 4242'
$utilities->formatCardNumber('378282246310005');       // '3782 822463 10005'

// Mask showing last 4 digits
$utilities->maskCardNumber('4242424242424242');        // '**** **** **** 4242'

// Validate number matches a specific type
$utilities->validateCardForType('4242424242424242', 'Visa');       // true
$utilities->validateCardForType('4242424242424242', 'Mastercard'); // false

// Filter cards by issuing country
$utilities->getCardsByCountry('BR');                              // ['Elo', 'Hipercard', 'Visa', ...]
$utilities->getCardsByCountry('BR', ['
bash
php artisan vendor:publish --tag=blade-payment-icons-config
bash
php artisan vendor:publish --tag=blade-payment-icons-svg
php artisan vendor:publish --tag=blade-payment-icons-views