2017 © Pedro Peláez
 

library modulus11

image

komakino/modulus11

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

The README.md

Modulus11

Modulus11 algorithm implementation for PHP. The Modulus11 algorithm is used in some bank account numbers and national identity numbers., (*1)

Installation

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

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

Usage

use Komakino\Modulus11\Modulus11;

Factors

The standard factors for Modulus11 calculations are [2,3,4,5,6,7], looped. In some cases other factors are used. If your implementation requires custom factors, simply supply them as a second argument to any method., (*3)

Static methods

static bool validate(string|int $number, array $factors = null), (*4)

Validates a number., (*5)

Modulus11::validate('11223344'); // returns false
Modulus11::validate('12345674'); // returns true

static int calculate(string|int $partial_number, array $factors = null), (*6)

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

Modulus11::calculate('1122334'); // returns 6
Modulus11::calculate('1234567'); // returns 4

static string appendCheckDigit(string|int $partial_number, array $factors = null), (*8)

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

Modulus11::appendCheckDigit('1122334'); // returns 11223346
Modulus11::appendCheckDigit('1234567'); // returns 12345674

The Versions

21/01 2016

dev-master

9999999-dev

  Sources   Download

The Development Requires

21/01 2016

v1.0.0

1.0.0.0

  Sources   Download

The Development Requires