Download the PHP package clntdev/blade-payment-icons without Composer
On this page you can find all versions of the php package clntdev/blade-payment-icons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clntdev/blade-payment-icons
More information about clntdev/blade-payment-icons
Files in clntdev/blade-payment-icons
Package blade-payment-icons
Short Description Laravel Blade components for SVG credit card and payment icons
License Apache-2.0
Informations about the package blade-payment-icons
Blade Payment Icons
A package to easily make use of Payment Icons in your Laravel Blade views.
Installation
The service provider is auto-discovered. To publish the config:
Optionally publish SVGs or views for customization:
Usage
This package provides two ways to use icons:
- Blade Icons syntax - standard
blade-ui-kit/blade-iconsintegration for simple icon rendering - Payment Icon component - enhanced component with alias resolution, auto-sizing, and variant support
Blade Icons (Recommended for simple usage)
Icons are available as Blade components, directives, and helpers via the blade-icons ecosystem.
The payicon prefix uses the configured default format (flat). To use a specific format, use the format-specific prefix:
| Format | Prefix | Example |
|---|---|---|
| Default (config) | payicon |
<x-payicon-visa /> |
| Flat | payflat |
<x-payflat-visa /> |
| Flat Rounded | payflatrounded |
<x-payflatrounded-visa /> |
| Logo | paylogo |
<x-paylogo-visa /> |
| Logo Border | paylogoborder |
<x-paylogoborder-visa /> |
| Mono | paymono |
<x-paymono-visa /> |
| Mono Outline | paymonooutline |
<x-paymonooutline-visa /> |
Note: Blade Icons syntax uses SVG filenames directly (e.g.,
americanexpress, notamex). For alias resolution and variant support, use the Payment Icon component below.
Payment Icon Component
The <x-payment-icon> component provides additional features including alias resolution, automatic aspect ratio sizing, and variant support.
Formats
Six visual formats are available: flat, flatRounded, logo, logoBorder, mono, monoOutline.
Sizing
Width defaults to 40px. Height is auto-calculated to maintain the 780:500 aspect ratio. You can set either dimension - the other adjusts automatically.
Aliases
Card types can be referenced by their aliases. These are case-insensitive and ignore dashes/underscores.
Variants
Some cards have variants. You can reference them directly by alias or use the variant prop.
Attribute Forwarding
Standard HTML/Blade attributes are forwarded to the rendered <svg> element.
The SVG includes role="img" and an aria-label by default for accessibility.
Available Icons
| Type | Display Name | Aliases | Variants |
|---|---|---|---|
| Visa | Visa | - | - |
| Mastercard | Mastercard | - | - |
| AmericanExpress | American Express | Amex | - |
| Discover | Discover | - | - |
| DinersClub | Diners Club | - | - |
| JCB | JCB | - | - |
| Maestro | Maestro | - | - |
| Elo | Elo | - | - |
| Mir | Mir | - | - |
| UnionPay | UnionPay | - | - |
| Hipercard | Hipercard | - | Hiper |
| Alipay | Alipay | - | - |
| PayPal | PayPal | - | - |
| Swish | Swish | - | - |
| Generic | Generic Card (Front) | GenericCard, GenericCardFront | Code (back/CVV), CodeFront (front CVV) |
The Generic card's Code variant has additional aliases: GenericBack, GenericCardBack, CvvBack, CvcBack, Cvv, Cvc. The CodeFront variant has: GenericFrontCode, CvvFront, CvcFront.
Icon Formats
| Format | Directory | Description |
|---|---|---|
flat |
flat/ |
Flat design |
flatRounded |
flat-rounded/ |
Flat with rounded corners |
logo |
logo/ |
Centered logo only |
logoBorder |
logo-border/ |
Logo with border |
mono |
mono/ |
Monochrome |
monoOutline |
mono-outline/ |
Monochrome outline |
Configuration
After publishing the config (config/blade-payment-icons.php), you can customize:
Defaults
Card Definitions
Each card entry in the cards array supports the following fields:
| Field | Type | Description |
|---|---|---|
type |
string |
Canonical type name used for file resolution (e.g. Visa, AmericanExpress) |
displayName |
string |
Human-readable name |
aliases |
string[] |
Alternative names that resolve to this type |
variants |
array |
Named sub-types with their own SVG files (see below) |
testNumbers |
string[] |
Sample card numbers for testing |
patterns |
array |
Regex patterns for card detection - full (complete numbers) and prefix (partial input) |
lengthRange |
array\|null |
min/max digit count, or null for non-card payment methods |
formatPattern |
array\|null |
Digit grouping for display formatting (e.g. [4, 4, 4, 4] or length-keyed like [14 => [4, 6, 4], 16 => [4, 4, 4, 4]]) |
issuingCountries |
string[]\|null |
ISO country codes or GLOBAL |
Variants
Variants are defined as a keyed array within a card definition:
The slug maps to an SVG file. For example, Hipercard's Hiper variant resolves to hiper.svg in the chosen format directory.
Pattern Matching
Cards are detected by regex patterns. The prefix pattern matches partial input (useful for real-time detection as users type), while full patterns validate complete card numbers:
Cards with more specific patterns are checked first to avoid false matches (e.g. Elo's specific BIN ranges are checked before Mastercard's broader 5xxx range).
Card Utilities
The package registers CardUtilities and CardMetadata as singletons. Resolve them from the container to detect, validate, format, and mask card numbers.
Credits
SVG icons and card utilities sourced from react-svg-credit-card-payment-icons
All versions of blade-payment-icons with dependencies
blade-ui-kit/blade-icons Version ^1.7
illuminate/support Version ^12.0|^13.0
illuminate/view Version ^12.0|^13.0