2017 © Pedro Peláez
 

library luhn-algorithm

Validate and create credit/bank/loyalty card numbers

image

chrsc/luhn-algorithm

Validate and create credit/bank/loyalty card numbers

  • Wednesday, July 19, 2017
  • by chrsc
  • Repository
  • 1 Watchers
  • 2 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 8 % Grown

The README.md

Luhn Algorithm

I created this as a utility class that will be used to validate card numbers, this works for credit card numbers, bank accounts, loyalty card numbers, and all other card numbers that follow the modulus 10 formula., (*1)

Other uses: Validate Canadian SIN / Greek SSN / Israel ID numbers, NPI numbers for American health care, IMEI numbers., (*2)

This could not have been created without Hans Peter Luhn's Algorithm., (*3)

Validate numbers

<?php
    $number = 123456;
    $luhn = new LuhnAlgorithm;
    if($luhn->validate($number)) {
        // number passes validation
    } else {
        // number does not pass validation
    }

Create numbers

<?php
    $luhn = new LuhnAlgorithm;
    $length = 16;
    $startswith = 4444;
    $cardnumber = $luhn->create($length, $startswith);
    // $cardnumber is now a valid card number that can be used or assigned

The Versions

19/07 2017

dev-master

9999999-dev

Validate and create credit/bank/loyalty card numbers

  Sources   Download

MIT

The Development Requires

by Chris Callender

creditcard luhn bankcard validatation

19/07 2017

1.0.0

1.0.0.0

Validate and create credit/bank/loyalty card numbers

  Sources   Download

MIT

The Development Requires

by Chris Callender

creditcard luhn bankcard validatation

19/07 2017

dev-develop

dev-develop

Validate and create credit/bank/loyalty card numbers

  Sources   Download

MIT

The Development Requires

by Chris Callender

creditcard luhn bankcard validatation