1. Go to this page and download the library: Download soiposervices/laravel-otp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
soiposervices / laravel-otp example snippets
SoipoServices\Otp\OtpServiceProvider::class
'Otp' => SoipoServices\Otp\OtpFacade::class
Otp::generate(string $identifier)
use OTP;
// in controller
$password = Otp::generate('reg:[email protected]');
use OTP;
// in controller
$result = Otp::validate('reg:[email protected]', '123456');
// in a `FormRequest`
use SoipoServices\Otp\Rules\OtpValidate;
public function rules()
{
return [
'code' => ['')]
]);
// Otp class
$result = Otp::validate('123456');
// in a `FormRequest`
use SoipoServices\Otp\Rules\OtpValidate;
public function rules()
{
return [
'code' => ['