PHPackages                             srph/luhn - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. srph/luhn

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

srph/luhn
=========

An implementation of Luhn algorithm (aka mod-10 algorithm) in PHP.

v0.1.0(11y ago)018MITPHP

Since Mar 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/srph/php-luhn)[ Packagist](https://packagist.org/packages/srph/luhn)[ RSS](/packages/srph-luhn/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

php-luhn [![Build Status](https://camo.githubusercontent.com/439742e80567cc3cf54b1cbf458781dbb1db72e74edf3cd002a36d18007c2fc1/68747470733a2f2f7472617669732d63692e6f72672f737270682f7068702d6c75686e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/srph/php-luhn?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/9806438c8d8af2a0c1f1e67a96da706a8f6565a57a9dced03e2396b9f06b50ea/68747470733a2f2f706f7365722e707567782e6f72672f737270682f6c75686e2f76657273696f6e2e737667)](https://packagist.org/packages/sroh/luhn) [![MIT license](https://camo.githubusercontent.com/4661abfe916186acde514558e7f040833cb63ba7098401a51ce339cbb2b4cf9e/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](http://opensource.org/licenses/MIT)
=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#php-luhn---)

An implementation of [Luhn algorithm (aka mod-10 algorithm)](http://en.wikipedia.org/wiki/Luhn_algorithm) to validate (verify the checksum of) credit card numbers in PHP.

\* *This was written to try out PHPUnit, but feel free to use it for anything as long as the MIT License permits*.

Installation
------------

[](#installation)

To install this library, simply run `composer require` in your project's root directory:

```
$ composer require srph/luhn
```

Usage
-----

[](#usage)

This library is very easy to use! Our `function` **only** accepts one `string` argument and `return`s a `boolean`.

```
