Download the PHP package eagleeye/otp without Composer
On this page you can find all versions of the php package eagleeye/otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package otp
LARAVEL OTP GENERATOR
A laravel package to generate OTP.
- Installation
- Vendor Publication
- Config
- Migrations
- Configuration
- Prefix
- Type
- Length
- Storage
- Expire
- Case
- Table Name
- Usage
- Get Method
- Interval Method
- Action Method
- Interval Action Method
- Verify
🚀 Installation
Composer will allows you to quickly install via the command line.
🚀Vendor Publishing
NOTE Publishing vendors are optional only required if you are willing to change configuration and use database as OTP storage.
Publish config file
Publish database migration file
✨ Configuration File
NOTE You will find the OTP configuration file in
configfolder name asotp.php.
otp.php
-
Prefix
-
The
prefixdefault value isnull. If you would like to add a text or trademark or a single character likegoogleregistrationOTPin every generated otp, Just add the prefix value.<br>Prefixand ActualOTPwill be seperated by a (-)Prefix Without Prefix With Prefix P 12345678 P-12345678
-
-
type
-
The
typerepresentOTPstring type .default value isnumeric.<br>Prefixand ActualOTPwill be seperated by a-Type Output Character Types numeric 12345678 Number alphabetic ktylnfdgf Alphabet alphanumeric kt7l7fdg9 Number,Alphabet mixnumeric !45<45! Number,Special Character mixalphabetic !tad%hgr Alphabet,Special Character mixalphanumeric !t4<7g! Number,Alphabet,Special Character
-
-
Length
-
The
lengthrepresent total number of character's in generatedOTP.Default length is 6.Length OTP 6 123456 8 12345678
-
-
Storage
Cache Storageused as default storage to store OTP .Dont forget to publish Otp migration file before usingdatabaseas OTP storage.storage Options:
cachesessiondatabase
-
Expire
expire- The validity period of the OTP in seconds
-
Case
-
The
case- differentiating between capital and lower-case letters.Case OTP lower generator upper GENERATOR
-
-
Table Name
table_name- With the name OTP databse migration table will be created .otp_tableis default table name.
🚀Usage
Import OTP facade
Static Function : get
This will generate a OTP that valid till expire time(configured in config file),For every otp request the method response new otp string with new expire time:
$key: The key that will be tied to the OTP.
Example
Static Function : interval
This will generate a OTP that valid till expire time(configured in config file),for new request it will generate new otp if only previous otp with the $key expired or empty:
$key: The key that will be tied to the OTP.
Example if otp hasnt expired
Example if otp expired
Static Function : action
This will generate a OTP that valid till expire time(configured in config file),For every otp request the method response new otp string with new expire time. The function takes one extra callable parameter to do additional work's(SMS,EMAIL,etc..) before returning otp string:
$key: The key that will be tied to the OTP.$callback: Take a callable function . Specially usefull to implement sms gateway's ,Email,etc...
Example
Static Function : intervalaction
Same as Interval the function will generate new otp until previous one expired:
$key: The key that will be tied to the OTP.$callback: Take a callable function . Specially usefull to implement sms gateway's ,Email,etc...
Example if otp hasnt expired
Example if otp expired
Static Function : Verify
This verify function will verify otp with generated otp and expired the otp from system.
Example
Static Function : Readonly
This will return a random generated string for other uses.
$options: It takes a array as parameter to replace Configuration file parameters.
Example
Author
👤 Shuvo Dewan
- Github: @shuvodewan
Contribution
If you find an issue with this package or you have any suggestion please help out.