PHP code example of padavvan / yii2-luhn-validator
1. Go to this page and download the library: Download padavvan/yii2-luhn-validator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
padavvan / yii2-luhn-validator example snippets
public function rules() {
return [
['creditCard', LuhnValidator::className()]
];
}
// OR
$model = \yii\base\DynamicModel::validateData(['digits' => '...'], [
['digits', LuhnValidator::className()]
]);
// OR
LuhnValidator::check($digits); // return true or false
bash
cd vendor/padavvan/yii2-luhn-validator
php ../../bin/codecept run