PHPackages                             convenia/credit-card-validator-php - 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. convenia/credit-card-validator-php

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

convenia/credit-card-validator-php
==================================

Fork Off inacho/php-credit-card-validator Because it looks like is not being manteined anymore --- Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date

1.1.0(6y ago)147.8k↓85.3%MITPHPPHP &gt;=5.3.0

Since Nov 27Pushed 6y agoCompare

[ Source](https://github.com/convenia/php-credit-card-validator)[ Packagist](https://packagist.org/packages/convenia/credit-card-validator-php)[ RSS](/packages/convenia-credit-card-validator-php/feed)WikiDiscussions master Synced today

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

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

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

[![Build Status](https://camo.githubusercontent.com/940606cbb6172cf2b8491d3134377a003af38b7f71ed68098156e834b39380fc/68747470733a2f2f7472617669732d63692e6f72672f696e6163686f2f7068702d6372656469742d636172642d76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/inacho/php-credit-card-validator) [![Coverage Status](https://camo.githubusercontent.com/07fcb4aaf7a1cfabe5e1bd464fd13dbc4aba12c1fa1d271ae75c318839b0a3bb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f696e6163686f2f7068702d6372656469742d636172642d76616c696461746f722f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/inacho/php-credit-card-validator?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/c19c0c0803e6d724cd75bc0242c42ec138e12a3e3264aa4ca47c46fd4d98913a/68747470733a2f2f706f7365722e707567782e6f72672f696e6163686f2f7068702d6372656469742d636172642d76616c696461746f722f76657273696f6e)](https://packagist.org/packages/inacho/php-credit-card-validator) [![Total Downloads](https://camo.githubusercontent.com/774269408cc89b547120d5d54cd85cf2e4b6a6da17aea658ec825ab16733425d/68747470733a2f2f706f7365722e707567782e6f72672f696e6163686f2f7068702d6372656469742d636172642d76616c696461746f722f646f776e6c6f616473)](https://packagist.org/packages/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.

This package is a Fork of inacho/php-credit-card-validator because it looks like isn't manteined anymore
--------------------------------------------------------------------------------------------------------

[](#this-package-is-a-fork-of-inachophp-credit-card-validator-because-it-looks-like-isnt-manteined-anymore)

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

[](#installation)

Require the package in `composer.json`

```
"require": {
    "convenia/credit-card-validator-php": "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
-----

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

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% 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

Every ~631 days

Total

4

Last Release

2238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e42289360cd0d7bf858aab87e1ae257ee47376c41712ae033380b4739e6b3f60?d=identicon)[vtrgomes](/maintainers/vtrgomes)

---

Top Contributors

[![inacho](https://avatars.githubusercontent.com/u/742624?v=4)](https://github.com/inacho "inacho (16 commits)")[![Arkanius](https://avatars.githubusercontent.com/u/6404401?v=4)](https://github.com/Arkanius "Arkanius (3 commits)")

---

Tags

laravelvalidatorcreditcardcardcreditdebitcvccardscreditcards

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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

2061.4M10](/packages/inacho-php-credit-card-validator)[intervention/validation

Additional validation rules for the Laravel framework

6776.6M6](/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.

44406.1k1](/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.

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

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

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

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

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

PHPackages © 2026

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