Download the PHP package marvinlabs/laravel-luhn without Composer
On this page you can find all versions of the php package marvinlabs/laravel-luhn. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marvinlabs/laravel-luhn
More information about marvinlabs/laravel-luhn
Files in marvinlabs/laravel-luhn
Informations about the package laravel-luhn
Laravel Luhn
marvinlabs/laravel-luhn is a laravel package providing various Laravel utilities to work with the
Luhn algorithm such as:
- a few validation rules
- dependency injection
- facade
The Luhn algorithm is used widely to verify that numbers are valid: credit card numbers, SIREN company codes, etc.
Installation
You can install the package via composer:
If you are using Laravel 5.5, the service provider and facade will automatically be discovered.
On earlier versions, you need to do that manually. You must install the service provider:
And optionally register an alias for the facade.
Usage
Algorithm implementation
The package provides an implementation to the algorithm interface defined in \MarvinLabs\Luhn\Contracts\LuhnAlgorithm.
The contract provides 3 public methods to:
- Check if an input string is valid according to the Luhn algorithm
- Compute the check digit to append to a string in order to make it valid
- Compute the checksum according to the Luhn algorithm
Facade
A facade is provided to access the Luhn algorithm implementation.
Dependency injection
You can get an implementation of the Luhn algorithm at any time using the Laravel container.
Validation
The package provides custom rules to validate a string.
Version history
See the dedicated change log
Credits
- Got some ideas from nekman/luhn-algorithm
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-luhn with dependencies
illuminate/support Version ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0