PHP code example of jacyimp / memorable-otp

1. Go to this page and download the library: Download jacyimp/memorable-otp 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/ */

    

jacyimp / memorable-otp example snippets


use JacyImp\MemorableOtp\MemorableOtp;

$code = MemorableOtp::readable(6); // e.g. 159915

MemorableOtp::readable(4); // e.g. 0112
MemorableOtp::readable(6); // e.g. 159915
MemorableOtp::readable(8); // e.g. 49649440

MemorableOtp::readable(6);  // e.g. 159915
MemorableOtp::easy(6);      // e.g. 100212
MemorableOtp::veryEasy(6);  // e.g. 012013
MemorableOtp::superEasy(6); // e.g. 010203
MemorableOtp::uberEasy(6);  // e.g. 121212

use JacyImp\MemorableOtp\MemorableOtp;
use JacyImp\MemorableOtp\ReadabilityPreset;

$code = MemorableOtp::generate(
    length: 7,
    preset: ReadabilityPreset::VeryEasy,
); // e.g. 4015642

$code = MemorableOtp::veryEasy(7); // e.g. 4015642

use JacyImp\MemorableOtp\MemorableOtp;
use JacyImp\MemorableOtp\ReadabilityPreset;

$security = MemorableOtp::security(
    length: 7,
    preset: ReadabilityPreset::UberEasy,
);

$security->rawSearchSpace();
$security->acceptedSearchSpace();
$security->entropyBits();
$security->entropyLossBits();
$security->exact;