Last active
April 18, 2018 08:10
-
-
Save gladchinda/65302b32cbce19983f9ee03ed548d515 to your computer and use it in GitHub Desktop.
Code to test how to use Keygen transformations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use Keygen\Keygen; | |
$splitString = function($key) { | |
return join('-', str_split($key, 4)); | |
}; | |
$shortHash20 = function($key) { | |
return substr(md5($key), mt_rand(0,8), 20); | |
}; | |
$reference = Keygen::numeric(20)->generate($splitString); | |
$filename = Keygen::bytes()->suffix('.png')->generate(true, ['strrev', $shortHash20], 'strtoupper'); | |
echo $reference; // 2129-1489-0676-5152-9337 | |
echo $filename; // 159D702E346F74E3F0B6.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment