PHPackages                             irabbi360/php-credit-card-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. irabbi360/php-credit-card-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

irabbi360/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

1.1(2y ago)8845↓50%3MITPHPPHP &gt;=5.3.0

Since Nov 2Pushed 1y agoCompare

[ Source](https://github.com/irabbi360/php-credit-card-validator)[ Packagist](https://packagist.org/packages/irabbi360/php-credit-card-validator)[ RSS](/packages/irabbi360-php-credit-card-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

PHP Credit Card Validator
=========================

[](#php-credit-card-validator)

[![License](https://camo.githubusercontent.com/7cb6bf280da167d96187a9fd18200403d0809a56af16c540ba8e86504c33f858/68747470733a2f2f706f7365722e707567782e6f72672f6972616262693336302f7068702d6372656469742d636172642d76616c696461746f722f6c6963656e7365)](https://packagist.org/packages/irabbi360/php-credit-card-validator)[![Latest Stable Version](https://camo.githubusercontent.com/6b414c52bebd29c31c8af02d6e6a7fd6181dc51206f78403c103b198f5d93e1b/68747470733a2f2f706f7365722e707567782e6f72672f6972616262693336302f7068702d6372656469742d636172642d76616c696461746f722f76657273696f6e)](https://packagist.org/packages/irabbi360/php-credit-card-validator)[![Total Downloads](https://camo.githubusercontent.com/f66c690b6e175779391c31ba6a9530523f593f77dcacdc384fc8c69e9f6b4f97/68747470733a2f2f706f7365722e707567782e6f72672f6972616262693336302f7068702d6372656469742d636172642d76616c696461746f722f646f776e6c6f616473)](https://packagist.org/packages/irabbi360/php-credit-card-validator)[![Daily Downloads](https://camo.githubusercontent.com/920bfd177ee6ca66546d05c89f8e4c661494e9d1f56f74456de7d88127ef2fc2/68747470733a2f2f706f7365722e707567782e6f72672f6972616262693336302f7068702d6372656469742d636172642d76616c696461746f722f642f6461696c79)](https://packagist.org/packages/irabbi360/php-credit-card-validator)

Validates popular debit and credit card numbers against regular expressions and the Luhn algorithm. It also validates the CVC and the expiration date.

Installation
------------

[](#installation)

```
composer require irabbi360/php-credit-card-validator
```

Require the package in `composer.json`

```
"require": {
    "irabbi360/php-credit-card-validator": "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'      => 'Irabbi360\CreditCard',

),
```

Usage
-----

[](#usage)

### Validate a card number knowing the type:

[](#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:

[](#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

[](#validate-the-cvc)

```
$validCvc = CreditCard::validCvc('234', 'visa');
var_dump($validCvc);
```

Output:

```
bool(true)

```

### Validate the expiration date

[](#validate-the-expiration-date)

```
$validDate = CreditCard::validDate('2013', '07'); // past date
var_dump($validDate);
```

Output:

```
bool(false)

```

Tests
-----

[](#tests)

Execute the following command to run the unit tests:

```
vendor/bin/phpunit

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

929d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3550a7f53f819e536401ac2a5357c930d6316a6c129f65b220332b0d0b42ad87?d=identicon)[irabbi360](/maintainers/irabbi360)

---

Top Contributors

[![inacho](https://avatars.githubusercontent.com/u/742624?v=4)](https://github.com/inacho "inacho (16 commits)")[![irabbi360](https://avatars.githubusercontent.com/u/35403788?v=4)](https://github.com/irabbi360 "irabbi360 (10 commits)")

---

Tags

credit-cardcredit-card-checkercredit-card-fraud-detectioncredit-card-validationcreditcardlaravel-credit-card-validationphp-credit-cardphp-credit-card-validationlaravelvalidatorcreditcardcardcreditdebitcvccardscreditcards

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/irabbi360-php-credit-card-validator/health.svg)

```
[![Health](https://phpackages.com/badges/irabbi360-php-credit-card-validator/health.svg)](https://phpackages.com/packages/irabbi360-php-credit-card-validator)
```

###  Alternatives

[inacho/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

2051.4M11](/packages/inacho-php-credit-card-validator)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[jlorente/php-credit-cards

A PHP package to perform operations on debit and credit cards like format, validate brand, number and Luhn algorithm. It validates popular brands like Visa, Mastercard, American Express, etc.

44421.2k1](/packages/jlorente-php-credit-cards)[freelancehunt/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.

18620.4k2](/packages/freelancehunt-php-credit-card-validator)[dragon-code/card-number

Generation and verification of card numbers using Luhn's algorithm.

6512.8k](/packages/dragon-code-card-number)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.3k](/packages/stuyam-laravel-phone-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
