Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created January 5, 2018 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gladchinda/46bc1cc217125f88d221b829a647c9f7 to your computer and use it in GitHub Desktop.
Save gladchinda/46bc1cc217125f88d221b829a647c9f7 to your computer and use it in GitHub Desktop.
Code to test how to use affixes with the Keygen package.
<?php
require __DIR__ . '/vendor/autoload.php';
use Keygen\Keygen;
// Prefix (inclusive enabled)
echo Keygen::numeric(12)->prefix('TM-')->generate(); // e.g TM-218624395
// Prefix (inclusive disabled)
echo Keygen::numeric(12)->prefix('TM-')->generate(true); // e.g TM-382104609735
// Suffix (inclusive enabled)
echo Keygen::alphanum(20)->suffix('.me')->generate(); // e.g 5UpwTe7cl268s31c9.me
// Suffix (inclusive disabled)
echo Keygen::alphanum(20)->suffix('.me')->generate(true); // e.g X1QkHm5OAI9q3F3VxNv8.me
// Combined (inclusive enabled)
echo Keygen::numeric(15)->prefix('TM-')->suffix('.me')->generate(); // e.g TM-101636457.me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment