thuraaung2493/otp-generator

A simple OTP generator.

dev-main 2024-09-07 07:56 UTC

This package is auto-updated.

Last update: 2025-01-07 08:40:40 UTC


README

Installation

composer require thuraaung2493/otp-generator:dev-main

Usage

use Thuraaung\OtpGenerator\OtpGenerator;

$generator = new OtpGenerator();
$generator->generate(); // 123456

Facade

use Thuraaung\OtpGenerator\Facades\OtpGenerator;
use Thuraaung\OtpGenerator\Enums\CaseType;

OtpGenerator::generate(); // 123456

Number Only

use Thuraaung\OtpGenerator\Facades\OtpGenerator

OtpGenerator::generate(8); // "123456"
OtpGenerator::generate(8); // "12345678"

English Alphabets Only

use Thuraaung\OtpGenerator\Facades\OtpGenerator

OtpGenerator::generateAlpha(6, CaseType::MIXED); // "pHwmLh"

Alpha Numeric

use Thuraaung\OtpGenerator\Facades\OtpGenerator

OtpGenerator::generateAlphaNumeric(6, CaseType::MIXED); // "S3I3V1"

Note: Uppercase only => CaseType::UPPERCASE, Lowercase only => CaseType::LOWERCASE, Mixed(default) => CaseType::MIXED

Test

  composer test

License

This package is open-sourced software licensed under the MIT license