PHPackages                             byrokrat/checkdigit - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. byrokrat/checkdigit

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

byrokrat/checkdigit
===================

Helper classes to calculate and validate ckecksums

2.1.0(7y ago)10209.3k↓11.4%43UnlicensePHPPHP &gt;=7.0

Since Jan 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/byrokrat/checkdigit)[ Packagist](https://packagist.org/packages/byrokrat/checkdigit)[ Docs](https://github.com/byrokrat/checkdigit)[ RSS](/packages/byrokrat-checkdigit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (3)

> ABANDONED! This package is discontinued and will not be updated.

Checkdigit
==========

[](#checkdigit)

[![Packagist Version](https://camo.githubusercontent.com/a0c8a652793ff6d3f565114248ef0f4c9befb7eae57ade60c14d6c1561b1e703/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6279726f6b7261742f636865636b64696769742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/byrokrat/checkdigit)[![Build Status](https://camo.githubusercontent.com/2bbcd67965114538609755424eb19e682ee95127efa0d5dd4bd22be2f2ab81ab/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6279726f6b7261742f636865636b64696769742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/byrokrat/checkdigit)[![Quality Score](https://camo.githubusercontent.com/a881a4fee96a66a9402ca79172d05617bbf07c843af0be0e5528af6425e2b800/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6279726f6b7261742f636865636b64696769742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/byrokrat/checkdigit)[![Scrutinizer Coverage](https://camo.githubusercontent.com/d30b4eede6fbddc64484f36fbb0daaa4e2054fe39eea251a5235d2d75ec499f2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6279726f6b7261742f636865636b64696769742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/byrokrat/checkdigit/?branch=master)

Helper classes to calculate and validate ckecksums.

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

[](#installation)

```
composer require byrokrat/checkdigit
```

Checkdigit requires the [bcmath](http://php.net/manual/en/book.bc.php) php extension.

API
---

[](#api)

The [`Calculator`](/src/Calculator.php) interface defines two methods:

- `isValid(string $number): bool` checks if number contains a valid check digit.
- `calculateCheckDigit(string $number): string` calculates the check digit for number.

Implementations include:

- [`Modulo10`](/src/Modulo10.php) and [`Luhn`](/src/Luhn.php) for modulo 10 check digits (Luhn is simply a shorthand for Modulo10).
- [`Modulo10Gtin`](/src/Modulo10Gtin.php) for modulo 10 check digits variant used in GTIN barcodes.
- [`Modulo11`](/src/Modulo11.php) for modulo 11 check digits.
- [`Modulo97`](/src/Modulo97.php) for modulo 97 check digits.

Usage
-----

[](#usage)

```
$luhn = new byrokrat\checkdigit\Luhn;

// outputs '1' (true)
echo $luhn->isValid('55555551');

// outputs '' (false)
echo $luhn->isValid('55555550');

// outputs '1'
echo $luhn->calculateCheckDigit('5555555');
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Every ~223 days

Total

7

Last Release

2788d ago

Major Versions

1.2.0 → 2.0.02017-12-05

PHP version history (2 changes)1.0.0PHP &gt;=5.4

1.2.0PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![hanneskod](https://avatars.githubusercontent.com/u/1369274?v=4)](https://github.com/hanneskod "hanneskod (36 commits)")[![AJenbo](https://avatars.githubusercontent.com/u/204594?v=4)](https://github.com/AJenbo "AJenbo (2 commits)")

---

Tags

eangtinisbnluhnmodulo-10modulo-11modulo-97upceanupcgtinluhnISBNcheck-digitmodulo 10modulo 11modulo 97

### Embed Badge

![Health badge](/badges/byrokrat-checkdigit/health.svg)

```
[![Health](https://phpackages.com/badges/byrokrat-checkdigit/health.svg)](https://phpackages.com/packages/byrokrat-checkdigit)
```

###  Alternatives

[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[imelgrat/barcode-validator

A PHP class for validating EAN, IMEI, ISBN, GTIN, SSCC, GSIN, UPC and other barcodes.

2188.1k](/packages/imelgrat-barcode-validator)[biblys/isbn

A PHP library to convert and validate ISBNs

56346.8k1](/packages/biblys-isbn)[marvinlabs/laravel-luhn

Luhn algorithm for Laravel

108409.7k](/packages/marvinlabs-laravel-luhn)[fale/isbn

ISBN library

88524.8k6](/packages/fale-isbn)[real-digital/gtin-validator

Real GTIN Validator

17414.3k1](/packages/real-digital-gtin-validator)

PHPackages © 2026

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