annaghd/php-credit-card-validator-plus
Larablocks Analysis
annaghd/php-credit-card-validator-plus works with any PHP project: the latest release (1.0.2, Jul 3, 2015) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Jul 3, 2015)
- 129 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jul 3, 2015.
- No releases in the last 12 months.
- First released: Nov 27, 2014.
- Monthly downloads: 129, about the same as six months ago.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.
| Install | |
|---|---|
composer require annaghd/php-credit-card-validator-plus |
|
| Latest Version: | 1.0.2 |
| PHP: | >=5.3.0 |
| License: | MIT |
| Last Updated: | Nov 1, 2017 |
| Links: | GitHub · Packagist |
PHP Credit Card Validator
Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date.
Installation
Require the package in composer.json
"require": {
"annaghd/php-credit-card-validator-plus": "1.*"
},
If you are using Laravel, add an alias in config/app.php
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
...
'View' => 'Illuminate\Support\Facades\View',
'CreditCard' => 'Inacho\CreditCard',
),
Usage
Validate a card number knowing the type:
$card = CreditCard::validCreditCard('5500005555555559', 'mastercard');
print_r($card);
Output:
Array
(
[valid] => 1
[number] => 5500005555555559
[type] => mastercard
)
Validate a card number and return the type:
$card = CreditCard::validCreditCard('371449635398431');
print_r($card);
Output:
Array
(
[valid] => 1
[number] => 371449635398431
[type] => amex
)
Validate the CVC
$validCvc = CreditCard::validCvc('234', 'visa');
var_dump($validCvc);
Output:
bool(true)
Validate the expiration date
$validMonth = CreditCard::validMonth('07'); // past date
var_dump($validMonth);
$validYear = CreditCard::validYear('2007'); // past date
var_dump($validYear);
Output:
bool(false)
bool(false)
Tests
Execute the following command to run the unit tests:
vendor/bin/phpunit
Alternatives to annaghd/php-credit-card-validator-plus
Validates popular debit and credit cards numbers against regular expressions and...
Provides support for Balance accounting system based on debit and credit princip...
Laravel >=5.6 integration for the PHP Credit Cards package that allows to perfor...
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.0.2 | >=5.3.0 | MIT | |
| 1.0.1 | >=5.3.0 | MIT | |
| 1.0.0 | >=5.3.0 | MIT |