PHPackages                             amiriskander/valid-credit-card - 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. amiriskander/valid-credit-card

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

amiriskander/valid-credit-card
==============================

Validate credit and debit cards given their card numbers and cvc number

v1.0.1(6y ago)119MITPHPPHP &gt;=7.1

Since Jan 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/amiriskander/valid-credit-card)[ Packagist](https://packagist.org/packages/amiriskander/valid-credit-card)[ RSS](/packages/amiriskander-valid-credit-card/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Valid Credit Card
=================

[](#valid-credit-card)

[![Build Status](https://camo.githubusercontent.com/75c46ad965a76634c07857e83c755aebde70a724c3f3122216af1644103862a4/68747470733a2f2f7472617669732d63692e6f72672f616d697269736b616e6465722f76616c69642d6372656469742d636172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/amiriskander/valid-credit-card) [![Latest Stable Version](https://camo.githubusercontent.com/098b3500b31504c4e94556a4149b83ad571cfdf04ca456ccb3534b01a8b3322e/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f76616c69642d6372656469742d636172642f76657273696f6e)](https://packagist.org/packages/amiriskander/valid-credit-card) [![Total Downloads](https://camo.githubusercontent.com/2b0f2c39f00026ef8a78a30bf12d1b2397aa48b473e3bb8e8090a4a171a649b2/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f76616c69642d6372656469742d636172642f646f776e6c6f616473)](https://packagist.org/packages/amiriskander/valid-credit-card) [![License](https://camo.githubusercontent.com/37c2e5e3c80cc5e704cddc902cfa3604fe07909a0789f01fc21be5c262d4773c/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f76616c69642d6372656469742d636172642f6c6963656e7365)](https://packagist.org/packages/amiriskander/valid-credit-card)

Simple and lightweight package that validates credit cards and debit cards for popular providers.

It validates cards against their card number lengths, card number patterns, CVC length and using Luhn algorithm if it were supported by the provider.

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

[](#installation)

Require the package using composer

```
composer require amiriskander/valid-credit-card
```

Or add it manually to `composer.json` in the list of dependencies under `require`

```
"require": {
    "amiriskander/valid-credit-card": "*"
},
```

Usage
-----

[](#usage)

### Validate Credit/Debit card:

[](#validate-creditdebit-card)

```
use AmirIskander\CreditCard\CreditCardValidator;

$cardValidator = new CreditCardValidator();
$isValid = $cardValidator->validateCreditCard('4539392426082460', '123');
var_dump($isValid);
```

Output:

```
bool(true)

```

Tests
-----

[](#tests)

Execute the below command to run the unit tests:

```
vendor/bin/phpunit tests
```

Resources
---------

[](#resources)

- [Freeformatter.com guide to validate credit card numbers](https://www.freeformatter.com/credit-card-number-generator-validator.html)
- [Ignacio de Tomás credit card validator repository](https://github.com/inacho/php-credit-card-validator)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

2307d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6437189?v=4)[Amir Iskander](/maintainers/amiriskander)[@amiriskander](https://github.com/amiriskander)

---

Tags

symfonylaravelvalidatorcreditcardcardcreditdebitcvc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/amiriskander-valid-credit-card/health.svg)

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

###  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)[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)[rollerworks/password-strength-validator

Password-strength validator for Symfony

1455.7M6](/packages/rollerworks-password-strength-validator)[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)[dragon-code/card-number

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

6512.8k](/packages/dragon-code-card-number)

PHPackages © 2026

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