Download the PHP package kenkioko/laravel-otp without Composer
On this page you can find all versions of the php package kenkioko/laravel-otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kenkioko/laravel-otp
More information about kenkioko/laravel-otp
Files in kenkioko/laravel-otp
Package laravel-otp
Short Description A simple package to generate and validate OTPs. [forked from ichtrojan/laravel-otp] (https://github.com/ichtrojan/laravel-otp)
License MIT
Informations about the package laravel-otp
Laravel OTP โฒ
Introduction ๐
This is a simple package to generate and validate OTPs (One Time Passwords). This can be implemented mostly in Authentication.
This is a fork from ichtrojan/laravel-otp.
In this version the default $identifier
type is App\User
instead of string
type.
Installation ๐ฝ
Install via composer
Add service provider to the config/app.php
file
Add alias to the config/app.php
file
Publish files with:
Run Migrations
Usage ๐งจ
NOTE Response are returned as objects. You can access its attributes with the arrow operator (
->
)
Generate OTP
$identifier
: The identity that will be tied to the OTP of type\App\User::class
.$digit (optional | default = 4)
: The amount of digits to be generated, can be any of 4, 5 and 6.$validity (optional | default = 5)
: The validity period of the OTP in minutes.
Sample
This will generate a six digit OTP that will be valid for 15 minutes and the success response will be:
Validate OTP
$identifier
: The identity that is tied to the OTP of type\App\User::class
.$token
: The token tied to the identity.
Sample
Extend Expiry of OTP
$identifier
: The identity that is tied to the OTP of type\App\User::class
.$token
: The token tied to the identity.$validity (optional | default = 1)
: The validity period of the OTP in minutes.
Sample
Responses
Uses Laravel's localization features to show the messages.
The translations are found in translations\en\messages.php
file.
Please use the file as a template for other languages.
On Success
Valid
Not Valid
Expired
Missing field
Mismatch
Expiry extended
Contribution
This is a fork from ichtrojan/laravel-otp.
If you find an issue with this package or you have any suggestion please help out. I am not perfect.