PHPackages                             samyan/bankcard-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. samyan/bankcard-validator

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

samyan/bankcard-validator
=========================

php bankcard validator

1.1(5y ago)11.8k↓65%MITPHPPHP &gt;=7.0

Since Dec 4Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Bank Card Validator
=======================

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

[![Latest Stable Version](https://camo.githubusercontent.com/3b3b649d28f7417752c56057d3fd23073ac09bee5947559e3b814f77d8e72334/68747470733a2f2f706f7365722e707567782e6f72672f73616d79616e2f62616e6b636172642d76616c696461746f722f76)](//packagist.org/packages/samyan/bankcard-validator)[![Total Downloads](https://camo.githubusercontent.com/c1d70467fb524a46a68aecc9be67c6e9ad6b7271ce81a714ff930e38354462fd/68747470733a2f2f706f7365722e707567782e6f72672f73616d79616e2f62616e6b636172642d76616c696461746f722f646f776e6c6f616473)](//packagist.org/packages/samyan/bankcard-validator)[![License](https://camo.githubusercontent.com/1d7d5011c8e34883606fd2c3821870e8a58dae29e4c2066bdf5ebd19650bc41e/68747470733a2f2f706f7365722e707567782e6f72672f73616d79616e2f62616e6b636172642d76616c696461746f722f6c6963656e7365)](//packagist.org/packages/samyan/bankcard-validator)

Validates debit and credit cards numbers against regular expressions and Luhn algorithm for **PHP 7.0+**Also validates the CVC and the expiration date. Project based on and inspired by [inacho/php-credit-card-validator](https://github.com/inacho/php-credit-card-validator)

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

[](#installation)

Require the package in `composer.json`

```
"require": {
    "samyan/bankcard-validator": "1.*"
},
```

Actual supported Bank Cards
---------------------------

[](#actual-supported-bank-cards)

**Debit cards**

- Visa Electron
- Maestro
- Forbrugsforeningen
- Dankort

**Credit cards**

- Visa
- Mastercard
- Amex
- Diners Club
- Discover
- UnionPay
- JCB (Japan Credit Bureau)
- Elo
- Hipercard
- Mir
- UATP (Universal Air Travel Plan)
- RuPay

Usage
-----

[](#usage)

### Validate a card number knowing the type:

[](#validate-a-card-number-knowing-the-type)

```
$card = BankCard::validateCardNumber('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 = BankCard::validateCardNumber('371449635398431');
print_r($card);
```

Output:

```
Array
(
    [valid] => 1
    [number] => 371449635398431
    [type] => amex
)

```

### Validate the CVC

[](#validate-the-cvc)

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

Output:

```
bool(true)

```

### Validate the expiration date

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

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

Output:

```
bool(false)

```

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

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

2073d ago

### Community

Maintainers

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

---

Top Contributors

[![samyan](https://avatars.githubusercontent.com/u/3801362?v=4)](https://github.com/samyan "samyan (12 commits)")

---

Tags

validatorcreditcardcardcreditdebitcvccardscreditcardsbankcard

### Embed Badge

![Health badge](/badges/samyan-bankcard-validator/health.svg)

```
[![Health](https://phpackages.com/badges/samyan-bankcard-validator/health.svg)](https://phpackages.com/packages/samyan-bankcard-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

2201.4M11](/packages/inacho-php-credit-card-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.

45478.4k1](/packages/jlorente-php-credit-cards)[composer/spdx-licenses

SPDX licenses list and validation library.

1.4k197.0M44](/packages/composer-spdx-licenses)[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.

18704.3k2](/packages/freelancehunt-php-credit-card-validator)[intervention/validation

Additional validation rules for the Laravel framework

6837.4M22](/packages/intervention-validation)[opis/json-schema

Json Schema Validator for PHP

65446.2M354](/packages/opis-json-schema)

PHPackages © 2026

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