2017 © Pedro Peláez
 

library luhn

image

komakino/luhn

  • Thursday, January 21, 2016
  • by komakino
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4,035 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 40 % Grown

The README.md

Luhn

Luhn algorithm implementation for PHP. The Luhn algorithm is used in credit card numbers and national identity numbers., (*1)

Installation

To add this package as a dependency to your project, simply add a dependency on komakino/luhn to your project's composer.json file., (*2)

    {
        "require": {
            "komakino/luhn": "*"
        }
    }

Usage

use Komakino\Luhn\Luhn;

Static methods

static bool validate(string|int $number), (*3)

Validates a number., (*4)

Luhn::validate('12345678'); // returns false
Luhn::validate('87654323'); // returns true

static int calculate(string|int $partial_number), (*5)

Calculates the check digit of a number., (*6)

Luhn::calculate('1234567'); // returns 4
Luhn::calculate('8765432'); // returns 3

static string appendCheckDigit(string|int $partial_number), (*7)

Calculates the check digit and returns number with check digit appended., (*8)

Luhn::appendCheckDigit('1234567'); // returns 12345674
Luhn::appendCheckDigit('8765432'); // returns 87654323

The Versions

21/01 2016

dev-master

9999999-dev

  Sources   Download

The Development Requires

21/01 2016

v1.0.3

1.0.3.0

  Sources   Download

The Development Requires

18/01 2016

v1.0.2

1.0.2.0

  Sources   Download

The Development Requires

18/01 2016

v1.0.1

1.0.1.0

  Sources   Download

The Development Requires

14/01 2016

v1.0.0

1.0.0.0

  Sources   Download

The Development Requires