shaheryarmahmod/luhnalgorithm

Luhn Algorithm Implementation to validate Debit & Credit Cards and IMEI numbers.

v1.0 2020-08-30 09:54 UTC

This package is auto-updated.

Last update: 2025-06-29 01:50:18 UTC


README

Luhn Algorithm Implementation in PHP to validate Debit & Credit Cards & IMEI numbers.

Composer

composer require shaheryarmahmod/luhnalgorithm

Example

<?php
require_once 'vendor/autoload.php';

use ShaheryarMahmod\LuhnAlgorithm;

$number = 4111111111111111;

// Check digit calculation
var_dump(LuhnAlgorithm::checksum($number));  // int(1)

// Validate numbers
var_dump(LuhnAlgorithm::isValid($number));   // bool(true)