HipsterJazzbo / laravel-luhn-validator by HipsterJazzbo

A luhn algorithm validator for Laravel 4's Validator
11,299
3
1
Package Data
Maintainer Username: HipsterJazzbo
Maintainer Contact: calebfidecaro@gmail.com (Caleb Fidecaro)
Package Create Date: 2014-06-26
Package Last Update: 2014-06-26
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 03:01:01
Package Statistics
Total Downloads: 11,299
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 3
Total Watchers: 1
Total Forks: 0
Total Open Issues: 1

Laravel Luhn Validator

A luhn algorithm validator for Laravel 4's Validator.

Installation

Start by adding this package to your composer.json:

"require-dev": {
    "hipsterjazzbo/laravel-luhn-validator": "1.*"
}

Now you've got to update composer:

$ composer update

And then add this package to the ServiceProviders array in your app/config/app.php:

'HipsterJazzbo\LaravelLuhnValidator\LaravelLuhnValidatorServiceProvider'

Usage

Just specify the new rule when you're defining your rules:

$rules = [
    'card_number' => [
        'required',
        'luhn'
    ]
];

Learn more about Laravel validation