Checking the number by Luhn algorithm. Look more about Luhn algorithm at wikipedia.
For license information check the LICENSE-file.
The preferred way to install this extension is through composer.
Either run
php composer.phar require padavvan/yii2-luhn-validator
or add
"padavvan/yii2-luhn-validator": "~1.0.2"
to the require section of your composer.json file.
Look more about Yii2 validators
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
cd vendor/padavvan/yii2-luhn-validator
php ../../bin/codecept run