soonio / redemption-code
This package is abandoned and no longer maintained.
No replacement package was suggested.
一个随机生成兑换码的简单库
v1.0
2021-03-23 07:47 UTC
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: 10.0.x-dev
README
use
composer require soonio/redemption-code
define chars
const CHARS = [ 'H', 'I', 'J', 'K', 'L', '8', '9', '3', '4', '5', 'O', 'P', 'Q', 'G', 'V', 'W', '1', '2', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'S', 'T', 'U', '6', '7', 'M', 'N', 'R', 'E', 'F', ];
generate
$rc = new soonio\rc\RedemptionCode(CHARS, 20); echo "redemption code: {$rc->generate()}\n";
verify
$bool = (new soonio\rc\RedemptionCode(CHARS, 20))->verify('I7AXXDN2TZXPQT788GV3'); echo $bool ? "验证通过\n" : "验证拒绝";
Differentiation
Only need to disrupt the order of the array of characters "CHARS" can be different in other people's projects.
Develop
run demo
php examples/index.php
test
composer test