https://github.com/sunaoka/damm
A PHP library that calculates and verifies the check digit using the Damm algorithm.
https://github.com/sunaoka/damm
checkdigit damm
Last synced: 7 months ago
JSON representation
A PHP library that calculates and verifies the check digit using the Damm algorithm.
- Host: GitHub
- URL: https://github.com/sunaoka/damm
- Owner: sunaoka
- Created: 2024-10-22T06:52:40.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-10-30T04:27:04.000Z (over 1 year ago)
- Last Synced: 2025-03-22T05:51:11.440Z (about 1 year ago)
- Topics: checkdigit, damm
- Language: PHP
- Homepage: https://packagist.org/packages/sunaoka/damm
- Size: 58.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Damm algorithm for PHP
[](https://packagist.org/packages/sunaoka/damm)
[](https://packagist.org/packages/sunaoka/damm)
[](composer.json)
[](https://github.com/sunaoka/damm/actions/workflows/test.yml)
[](https://codecov.io/gh/sunaoka/damm)
---
A PHP library that calculates and verifies the check digit using the [Damm algorithm](https://en.wikipedia.org/wiki/Damm_algorithm).
Quasigroups are supported from order 3 to order 64 as well as order 10.
## Installation
```bash
composer require sunaoka/damm
```
## Usage
### Quasigroup of order 10 (default)
```php
calculate('572');
// => 4
var_dump($damm->validate('5724'));
// => bool(true)
```
### Quasigroup of order 62
```php
calculate('4MTYDKH0S0E');
// => D
var_dump($damm->validate('4MTYDKH0S0ED'));
// => bool(true)
```