PHP code example of ankurk91 / laravel-otp

1. Go to this page and download the library: Download ankurk91/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/ */

    

ankurk91 / laravel-otp example snippets



$phoneNumber = '+1234567890';

$secret = otp()->generate($phoneNumber, 6)
// You can send $secret via SMS/Email to user

otp()->match($phoneNumber, request('otp'));

otp()->forget($phoneNumber);


use Ankurk91\LaravelOTP\Facades\OTP;

$secret = OTP::generate($phoneNumber)
bash
php artisan vendor:publish --provider="Ankurk91\LaravelOTP\OTPServiceProvider" --tag="config"