Luhn library, modulo 10

1.2.0 2023-09-09 19:32 UTC

This package is auto-updated.

Last update: 2024-10-09 22:52:17 UTC


README

Luhn (modulus 10 or mod 10 algorithm) for PHP

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Requirements

  • PHP 8.1+

Installation

composer require selective/luhn

Usage

Create a number

<?php

use Selective\Luhn\Luhn;

$luhn = new Luhn();

echo $luhn->create('7992739871'); // 3

Validate a number

<?php

use Selective\Luhn\Luhn;

$luhn = new Luhn();

$luhn->validate('79927398713'); // true
$luhn->validate('79927398710'); // false

License

  • MIT