plasmaconduit / luhn
This package is abandoned and no longer maintained.
No replacement package was suggested.
There is no license information available for the latest version (v0.1.0) of this package.
v0.1.0
2013-02-13 05:50 UTC
Requires
- plasmaconduit/map: 0.1.*
Requires (Dev)
This package is not auto-updated.
Last update: 2016-11-19 07:47:40 UTC
README
An implementation of the Luhn algorithm for verifying the checksum of credit card numbers.
<?php use PlasmaConduit\Luhn; echo "The '4012888888881881' CC# is "; if (Luhn::validate("4012888888881881")) { echo "valid\n"; } else { echo "invalid\n"; }
Public Interface
namespace PlasmaConduit; class Luhn { /** * Takes a number and calculates the Luhn checksum of it * * @param {Int} $number - The number to calculate the checksum for * @return {Int} - The computed checksum */ static public function checksum($number); /** * Given an incomplete Luhn this calculates the check digit * * @param {Int} $number - The incomplete number to derive the check digit * @return {Int} - The derived check digit */ static public function getCheckDigit($number); /** * Given a complete Luhn this function returns true if it's valid * * @param {Int} $number - The Luhn to validate * @return {Boolean} - True on valid false otherwise */ static public function validate($number); }