PHPackages                             gdianov/yii2-creditcard-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. gdianov/yii2-creditcard-validator

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

gdianov/yii2-creditcard-validator
=================================

Validate credit cards.

v1.0(9y ago)1788MITPHP

Since Jun 28Pushed 9y ago2 watchersCompare

[ Source](https://github.com/gdianov/yii2-creditcard-validator)[ Packagist](https://packagist.org/packages/gdianov/yii2-creditcard-validator)[ RSS](/packages/gdianov-yii2-creditcard-validator/feed)WikiDiscussions master Synced 3w ago

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

yii2-creditcard-validator
=========================

[](#yii2-creditcard-validator)

Supported cards :
-----------------

[](#supported-cards-)

1. `visaelectron`
2. `maestro`
3. `forbrugsforeningen`
4. `dankort`
5. `visa`
6. `mastercard`
7. `amex`
8. `dinersclub`
9. `discover`
10. `unionpay`
11. `jcb`

Install: `"require":  { "gdianov/yii2-creditcard-validator": "^1.0" }, `

How to use?
===========

[](#how-to-use)

You can attach the validator as a model or use it directly.

```
public function rules() {
       return [
           [['text'], 'string'],
           ['card', CreditCardValidator::className(), 'type' => 'mastercard', 'luhn' => true],
           [['date'], 'safe'],
       ];
    }

CreditCardValidator::validateCard('mastercard', 5100000000000000, true); //return true or false
```

Params:

1. type of card.
2. value for validation
3. apply luhn algorithm ([https://en.wikipedia.org/wiki/Luhn\_algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm))

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3285d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/81362856?v=4)[s0maly](/maintainers/s0maly)[@s0maly](https://github.com/s0maly)

---

Top Contributors

[![gdianov](https://avatars.githubusercontent.com/u/13520354?v=4)](https://github.com/gdianov "gdianov (7 commits)")

---

Tags

validaterecordyii2activecreditcards

### Embed Badge

![Health badge](/badges/gdianov-yii2-creditcard-validator/health.svg)

```
[![Health](https://phpackages.com/badges/gdianov-yii2-creditcard-validator/health.svg)](https://phpackages.com/packages/gdianov-yii2-creditcard-validator)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[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

2071.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.

45445.5k1](/packages/jlorente-php-credit-cards)

PHPackages © 2026

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