sunaoka/damm

A PHP library that calculates and verifies the check digit using the Damm algorithm.

Maintainers

Details

github.com/sunaoka/damm

Source

Issues

Installs: 57

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/sunaoka/damm

v1.2.0 2025-09-25 02:06 UTC

This package is auto-updated.

Last update: 2025-10-25 02:17:38 UTC


README

Latest License PHP Test codecov

A PHP library that calculates and verifies the check digit using the Damm algorithm.

Quasigroups are supported from order 3 to order 64 as well as order 10.

Installation

composer require sunaoka/damm

Usage

Quasigroup of order 10 (default)

<?php

use Sunaoka\Damm\Damm;

$damm = new Damm('0123456789');

echo $damm->calculate('572');
// => 4

var_dump($damm->validate('5724'));
// => bool(true)

Quasigroup of order 62

<?php

use Sunaoka\Damm\Damm;
use Sunaoka\Damm\Order\Order62;

$damm = new Damm('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', new Order62());

echo $damm->calculate('4MTYDKH0S0E');
// => D

var_dump($damm->validate('4MTYDKH0S0ED'));
// => bool(true)