An open API service indexing awesome lists of open source software.

https://github.com/selective-php/luhn

Luhn (Modulo 10 or mod 10 algorithm) for PHP
https://github.com/selective-php/luhn

hacktoberfest luhn luhn-checksum php

Last synced: about 1 year ago
JSON representation

Luhn (Modulo 10 or mod 10 algorithm) for PHP

Awesome Lists containing this project

README

          

# Luhn

[Luhn](https://en.wikipedia.org/wiki/Luhn_algorithm) (modulus 10 or mod 10 algorithm) for PHP

[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/luhn.svg)](https://packagist.org/packages/selective/luhn)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![Build Status](https://github.com/selective-php/luhn/workflows/build/badge.svg)](https://github.com/selective-php/luhn/actions)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/selective-php/luhn.svg)](https://scrutinizer-ci.com/g/selective-php/luhn/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/quality/g/selective-php/luhn.svg)](https://scrutinizer-ci.com/g/selective-php/luhn/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/selective/luhn.svg)](https://packagist.org/packages/selective/luhn/stats)

## Requirements

* PHP 8.1+

## Installation

```
composer require selective/luhn
```

## Usage

### Create a number

```php
create('7992739871'); // 3
```

### Validate a number

```php
validate('79927398713'); // true
$luhn->validate('79927398710'); // false
```

## License

* MIT