PHP code example of itsmeabde / easy-otp
1. Go to this page and download the library: Download itsmeabde/easy-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/ */
itsmeabde / easy-otp example snippets
bash
$ php artisan vendor:publish --tag=otp
$ php artisan migrate
php
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Itsmeabde\EasyOtp\Exceptions\OtpException;
use Itsmeabde\EasyOtp\Otp;
class OtpController extends Controller
{
public $otp;
public function __construct(Otp $otp)
{
$this->otp = $otp;
}
public function create(Request $request): JsonResponse
{
$request->validate([
'name' => ' $request->validate([
'identifier' => ' ]);
}
public function resend(Request $request): JsonResponse
{
$request->validate(['identifier' => '