sunaoka / damm
A PHP library that calculates and verifies the check digit using the Damm algorithm.
v1.2.0
2025-09-25 02:06 UTC
Requires
- php: ^7.2 || ^8.0
Requires (Dev)
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.3
This package is auto-updated.
Last update: 2025-09-25 02:07:34 UTC
README
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)