1. Go to this page and download the library: Download verifinow/laravel 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/ */
use VerifyNow\Laravel\Services\IDVService;
use VerifyNow\Laravel\Services\AuthenticationService;
// IDV Service
$idvService = app(IDVService::class);
$result = $idvService->request(['user_id' => 1, 'country' => 'US']);
$isApproved = $idvService->isSuccessful($verification_id);
// Authentication Service
$authService = app(AuthenticationService::class);
$result = $authService->request(['user_id' => 1, 'verification_id' => $vid]);
$confidenceScore = $authService->getConfidenceScore($verification_id);
use VerifyNow\Laravel\Traits\Verifiable;
use VerifyNow\Laravel\Traits\HasVerifications;
class User extends Model
{
use Verifiable, HasVerifications;
}
// Check if user is verified
$user->isVerified(); // bool
// Get latest verification
$verification = $user->latestVerification();
// Check if
// Require verification for routes
Route::middleware('verifinow.verified')->group(function () {
Route::get('/verified-content', function () {
// Only verified users access
});
});
// Require specific verification type
Route::middleware('verifinow.verified:idv')->group(function () {
// Only IDV verified users
});
Route::middleware('verifinow.verified:authentication')->group(function () {
// Only authenticated users
});
use VerifyNow\Laravel\Events\VerificationCompleted;
use VerifyNow\Laravel\Events\VerificationFailed;
use Illuminate\Support\Facades\Event;
Event::listen(VerificationCompleted::class, function ($event) {
$verification = $event->verification;
if ($verification->isApproved()) {
// Notify user verification succeeded
$user = $verification->user;
$user->notify(new VerificationApprovedNotification());
}
});
Event::listen(VerificationFailed::class, function ($event) {
// Handle verification failure
Log::error('Verification failed', ['verification' => $event->verification]);
});
// Configure webhook in VerifyNow dashboard:
// Webhook URL: https://yourapp.com/api/webhooks/verifinow
// Events: verification.completed, verification.failed, etc.
// Get the main service
verify_now();
// Get the manager
verifinow_manager();
// Request IDV verification
request_idv(['user_id' => 1, 'country' => 'US']);
// Request authentication
request_authentication(['user_id' => 1, 'verification_id' => 'ver_xxx']);
// Check verification status
check_verification_status('ver_xxx');