PHPackages                             silici0/credit-card-class - 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. silici0/credit-card-class

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

silici0/credit-card-class
=========================

0.0.1(11y ago)019PHP

Since Nov 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/silici0/credit-card-class)[ Packagist](https://packagist.org/packages/silici0/credit-card-class)[ RSS](/packages/silici0-credit-card-class/feed)WikiDiscussions master Synced 1mo ago

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

Credit Card Class
=================

[](#credit-card-class)

Simple PHP class for preparing and validating credit/debit card details. Typically this takes place before they are passed to a payment gateway for processing.

Example Usage
-------------

[](#example-usage)

```
$card_details = array(
	'number' =>'4929000000006',
	'expiry_year' => 2013,
	'expiry_month' => 5,
	'code' => '123'
);

$card = new Card();
$card->populate($card_details);

if (!$card->is_valid($message)) {
    // show error message
    echo 'There is a problem with your card details: ' . $message;
} else {
    // get the prepped, validated card data as an array
    $card_data = $card->to_array();
    // send $card_data to payment gateway
}
```

Data preparation
----------------

[](#data-preparation)

This class does some simple preparation of your card data. This includes removing non-numeric characters, including spaces, from:

- The card number
- The CVC/CV2 value
- The card expiry date

Validation Checks
-----------------

[](#validation-checks)

This class also checks:

- That the card hasn't expired
- A valid CVC/CV2 security code has been supplied
- The card number passes the Luhn check

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

4185d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/261987ce76cce5e1d43fbde312f1f47c819cba2195ebb1f4955bdff9d12763bb?d=identicon)[silici0](/maintainers/silici0)

---

Top Contributors

[![silici0](https://avatars.githubusercontent.com/u/61994?v=4)](https://github.com/silici0 "silici0 (8 commits)")

### Embed Badge

![Health badge](/badges/silici0-credit-card-class/health.svg)

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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