Download the PHP package kaffe-software/laravel-otp without Composer
On this page you can find all versions of the php package kaffe-software/laravel-otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaffe-software/laravel-otp
More information about kaffe-software/laravel-otp
Files in kaffe-software/laravel-otp
Package laravel-otp
Short Description A simple package to generate and validate OTPs
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.
Installation ๐ฝ
Install via composer
Add service provider to the config/app.php
file
Add alias to the config/app.php
file
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.$digit (optional | default = 4)
: The amount of digits to be generated, can be any of 4, 5 and 6.$validity (optional | default = 10)
: 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.$token
: The token tied to the identity.
Sample
Responses
On Success
Does not exist
**Not Valid***
Expired
Delete expired tokens
You can delete expired tokens by running the following artisan command:
You can also add this artisan command to app/Console/Kernel.php
to automatically clean on scheduled
Contribution
If you find an issue with this package or you have any suggestion please help out. I am not perfect.