Download the PHP package carddetective/card-provider-detector without Composer
On this page you can find all versions of the php package carddetective/card-provider-detector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download carddetective/card-provider-detector
More information about carddetective/card-provider-detector
Files in carddetective/card-provider-detector
Package card-provider-detector
Short Description A PHP library to detect the card provider from a card number
License MIT
Informations about the package card-provider-detector
Card Detective - Advanced Card Detection & Validation Package
The card-provider-detector package is a comprehensive PHP library for detecting card providers, validating card numbers, and providing detailed card information. The package uses the first six digits of the card number (BIN) along with advanced validation algorithms to accurately detect and validate various card types.
โจ Features
- ๐ Card Provider Detection: Supports 12+ major card providers including Visa, MasterCard, American Express, and regional cards
- โ Luhn Algorithm Validation: Built-in validation using the industry-standard Luhn algorithm
- ๐ญ Card Number Masking: Secure masking of card numbers for display purposes
- ๐ Card Number Formatting: Format card numbers with custom separators
- ๐ Security Features: CVV/CVC validation and expiry date checking
- ๐ Detailed Card Information: Comprehensive card data including type, length, and features
- ๐ Regional Support: Support for regional card networks (RuPay, UnionPay, Mir, Elo, etc.)
- โ๏ธ Configurable: Customizable settings and provider configurations
- ๐ก๏ธ Exception Handling: Proper error handling with custom exceptions
- ๐งช Comprehensive Testing: Extensive test coverage with 50+ test cases
- ๐ฑ Laravel Integration: Seamless Laravel integration with facade and service provider
๐ Installation
Install the package via Composer:
๐ Requirements
- PHP 8.1 or higher
- Laravel 5.5+ (for Laravel integration)
๐ฏ Supported Card Providers
| Provider | Type | Length | Security Code |
|---|---|---|---|
| Visa | Credit/Debit | 13, 16, 19 | 3 digits |
| MasterCard | Credit/Debit | 16 | 3 digits |
| American Express | Credit | 15 | 4 digits |
| Diners Club | Credit | 14 | 3 digits |
| JCB | Credit | 15, 16 | 3 digits |
| Discover | Credit | 16 | 3 digits |
| RuPay | Credit/Debit | 16 | 3 digits |
| UnionPay | Credit/Debit | 16-19 | 3 digits |
| Maestro | Debit | 12-19 | None |
| Elo | Credit | 16 | 3 digits |
| Mir | Credit/Debit | 16 | 3 digits |
| Hipercard | Credit | 13, 16 | 3 digits |
๐ Usage
Basic Usage
Advanced Usage - Card Information
Security Features
Custom Formatting
๐๏ธ Laravel Integration
Service Provider Registration
Register the service provider in config/app.php:
Using the Facade
Dependency Injection
โ๏ธ Configuration
Publish the configuration file:
Configuration Options
๐งช Testing
Run the comprehensive test suite:
The package includes 50+ test cases covering:
- All supported card providers
- Card validation scenarios
- Masking and formatting
- Security features
- Edge cases and error handling
- Laravel integration
๐ก๏ธ Exception Handling
The package includes custom exceptions for better error handling:
๐ง Advanced Features
Custom Card Providers
Add support for custom card providers:
Batch Processing
Process multiple cards efficiently:
API Integration
Perfect for payment gateway integrations:
๐ Use Cases
- E-commerce Platforms: Validate customer payment cards
- Payment Gateways: Detect card types for processing
- Financial Applications: Secure card number handling
- CRM Systems: Store masked card information
- Analytics: Track payment method usage
- Security Audits: Validate card data integrity
๐ Performance
- Fast Detection: Optimized regex patterns for quick provider detection
- Memory Efficient: Minimal memory footprint
- Cached Results: Built-in caching for repeated operations
- Scalable: Handles high-volume card processing
๐ Security Considerations
- No Card Storage: Package doesn't store card numbers
- PCI Compliance: Designed with PCI DSS guidelines in mind
- Secure Masking: Proper card number masking for display
- Input Sanitization: Automatic sanitization of card inputs
- Exception Safety: Secure error handling without data leakage
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
The MIT License (MIT). Please see License File for more information.
๐จโ๐ป Author
๐ Changelog
Version 2.0.0
- โจ Added comprehensive card information (CardInfo DTO)
- ๐ Added CVV/CVC validation
- ๐ Added expiry date validation
- ๐ญ Enhanced card masking with custom characters
- ๐ Added card number formatting utilities
- ๐ Added support for regional cards (Elo, Mir, Hipercard)
- โ๏ธ Added configuration system
- ๐ก๏ธ Added proper exception handling
- ๐งช Expanded test coverage (50+ tests)
- ๐ Updated documentation
Version 1.0.0
- ๐ฏ Basic card provider detection
- โ Luhn algorithm validation
- ๐ญ Basic card masking
- ๐๏ธ Laravel integration
โ ๏ธ Disclaimer: This package is for educational and development purposes. Always follow PCI DSS guidelines and security best practices when handling card data in production environments.