Download the PHP package nekman/luhn-algorithm without Composer
On this page you can find all versions of the php package nekman/luhn-algorithm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of luhn-algorithm with dependencies
Informations about the package luhn-algorithm
This is a zero dependency implementation of the Luhn Algorithm for PHP 7.4 and above. The Luhn Algorithm is used to validate things like credit cards and national identification numbers. More information on the algorithm can be found at Wikipedia.
Install with Composer:
In order to instantiate a new instance of the library, use the factory:
You can find the library facade in the
Number class is a container class that holds the actual number and the check digit. It does no validation nor does it calculate the check digit. It exists to clearly separate the number from the check digit and to define when the check digit exists or not. To simplify the process of validating a number you can use the named constructor
Number::fromString() like this:
Alternatively, if you want to calculate the checksum or check digit for a number:
This project complies with Semantic Versioning.
For a complete list of changes, and how to migrate between major versions, see releases page.