thuraaung2493 / otp-generator
A simple OTP generator.
dev-main
2024-09-07 07:56 UTC
Requires
- php: ^8.2
- nunomaduro/mock-final-classes: ^1.2
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^1.10
- orchestra/testbench: ^8.5
- pestphp/pest: ^2.6
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