Download the PHP package nealyip/laravel-otp-validation without Composer
On this page you can find all versions of the php package nealyip/laravel-otp-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nealyip/laravel-otp-validation
More information about nealyip/laravel-otp-validation
Files in nealyip/laravel-otp-validation
Package laravel-otp-validation
Short Description Validate before making action with otp
License MIT
Homepage https://github.com/nealyip/laravel-otp-validation
Informations about the package laravel-otp-validation
Description
The packages handle otp in various way for you. It is designed for modal dialog and called by ajax.
Install
Add this provider to config/app.php
Publish config
Configuration
You may translate error message under resources/lang/vendor/otp_messages
By default it use log transport service, you may change it to the given mail service or write your own sms provider.
For the given mail service, simply change config/otp_validation.php
for the default mail transport class, define your mail driver, from address and name (MAIL_FROM_ADDRESS and MAIL_FROM_NAME for smtp)
OTP_SEED
you can change the seed for otp by changing OTP_SEED env
check otp_validation.php for more details
Development
To implement your own transport interface, simply implement the Nealyip\LaravelOTPValidation\Transport\TransportInterface interface. for example,
and change your config file (config/otp_validation.php)
How to use
First you are required to implement Nealyip\LaravelOTPValidation\OTP\OTPTarget to your user model. Implement the target user mobile number and email address functions for otp transportation.
Add routes for password attempt and resend request
To send the first otp, just call the send method from the OTPValidationService
And you may build a modal dialog from the client side and ask for the password.
To attempt a password, just call the routes, for example
to request resend
if the otp is correct it will return a success response with HTTP status code 200
you can then consume the otp