1. Go to this page and download the library: Download sanjabteam/verify 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/ */
sanjabteam / verify example snippets
use Verify;
use App\Helpers\SmsVerifyMethod;
$result = Verify::request($request->input('mobile'), SmsVerifyMethod::class);
if ($result['success'] == false) { // If user exceed limitation
return redirect()->back()->with('error', $result['message']); // Show error message
}
namespace App\Helpers;
use SanjabVerify\Contracts\VerifyMethod;
class SmsVerifyMethod implements VerifyMethod
{
public function send(string $receiver, string $code)
{
// Send code to receiver
if (send_sms($receiver, 'Your code is :'.$code) == 'success') {
return true; // If code sent successfuly then return true
}
return false; // If send code failed return false
}
}
$request->validate([
'code' => '
use Verify;
$result = Verify::verify($request->input('mobile'), $request->input('code'));
if ($result['success'] == false) {
// Show error $result['message']
}