PHPackages                             thatsus/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. thatsus/credit\_card\_validator

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

thatsus/credit\_card\_validator
===============================

v1.0.0(10y ago)021HTML

Since Sep 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/thatsus/credit_card_validator)[ Packagist](https://packagist.org/packages/thatsus/credit_card_validator)[ RSS](/packages/thatsus-credit-card-validator/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

credit\_card\_validator
=======================

[](#credit_card_validator)

This is a jquery credit card validator from jqueryscript.net

A simple jQuery plugin to check and display the credit card type as the user types, and to provide Bootstrap validation classes for Luhn check once the correct length has been verified.

How to use it:

1. Include the necessary jQuery library and Bootstrap's CSS in the web page.

&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt; 2. Include the jQuery creditCardValidator plugin after jQuery library. &lt;script src="jquery.creditCardValidator.js"&gt;&lt;/script&gt; 3. Create a text field for credit card input.

4\. The CSS to add a default credit card image into the credit card input.

1 #checkout\_card\_number { 2 background-image: url(cards.png); 3 background-position: 3px 3px; 4 background-size: 40px 252px; 5 background-repeat: no-repeat; 6 padding-left: 48px; 7 } 5. The Javascript.

var $cardinput = $('#checkout\_card\_number'); $('#checkout\_card\_number').vali[date](http://www.jqueryscript.net/time-clock/)CreditCard(function(result) {

if (result.card\_type != null) {

switch (result.card\_type.name) { case "visa": $cardinput.css('background-position', '3px -34px'); $cardinput.addClass('card\_visa'); break;

case "visa\_electron": $cardinput.css('background-position', '3px -72px'); $cardinput.addClass('card\_visa\_electron'); break;

case "mastercard": $cardinput.css('background-position', '3px -110px'); $cardinput.addClass('card\_mastercard'); break;

case "maestro": $cardinput.css('background-position', '3px -148px'); $cardinput.addClass('card\_maestro'); break;

case "discover": $cardinput.css('background-position', '3px -186px'); $cardinput.addClass('card\_discover'); break;

case "amex": $cardinput.css('background-position', '3px -223px'); $cardinput.addClass('card\_amex'); break;

default: $cardinput.css('background-position', '3px 3px'); break; } } else { $cardinput.css('background-position', '3px 3px'); }

// Check for valid card numbers - only show validation checks for invalid Luhn when length is correct so as not to confuse user as they type. if (result.length\_valid || $cardinput.val().length &gt; 16) { if (result.luhn\_valid) { $cardinput.parent().removeClass('has-error').addClass('has-success'); } else { $cardinput.parent().removeClass('has-success').addClass('has-error'); } } else { $cardinput.parent().removeClass('has-success').removeClass('has-error'); } });

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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

3943d ago

### Community

Maintainers

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

---

Top Contributors

[![thatsus-master](https://avatars.githubusercontent.com/u/16006839?v=4)](https://github.com/thatsus-master "thatsus-master (4 commits)")

### Embed Badge

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

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

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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