承接 verifinow/laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

verifinow/laravel

Composer 安装命令:

composer require verifinow/laravel

包简介

Official VerifyNow Laravel package for Age Verification and Identity Verification

README 文档

README

Latest Version on Packagist License

Official Laravel package for VerifyNow Age Verification and Identity Verification services.

Features

  • 🆔 Identity Verification (IDV) - Document-based verification
  • 😊 Facial Recognition - Liveness detection and face matching
  • 🔐 Webhook Support - Automatic verification status updates
  • 🛡️ Signature Verification - Secure webhook validation
  • 📊 Database Models - Track all verifications and attempts
  • 🎯 Route Middleware - Protect routes with verification requirements
  • 📡 Event System - React to verification completion/failure
  • 🧪 Fully Tested - Comprehensive test suite included

Requirements

  • PHP 8.3+
  • Laravel 11.0+
  • Guzzle HTTP 7.0+

Installation

composer require verifinow/laravel

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="VerifyNow\Laravel\VerifyNowServiceProvider" --tag=verifinow-config

Add to your .env:

VERIFINOW_API_KEY=sk_live_xxxxxxxxxxxxx
VERIFINOW_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxx
VERIFINOW_BASE_URL=https://7on7-backend.verifinow.io
VERIFINOW_TIMEOUT=30
VERIFINOW_REGISTER_ROUTES=true
VERIFINOW_QUEUE_VERIFICATIONS=false

Database Setup

Publish and run migrations:

php artisan vendor:publish --provider="VerifyNow\Laravel\VerifyNowServiceProvider" --tag=verifinow-migrations
php artisan migrate

Usage

Basic Usage with Facades

use VerifyNow\Laravel\Facades\VerifyNow;

// Request ID Verification
$response = VerifyNow::requestIDV([
    'user_id' => auth()->id(),
    'country' => 'US',
    'document_type' => 'passport',
]);

// Check verification status
$status = VerifyNow::checkVerificationStatus($response['verification_id']);

// Request facial authentication
$auth = VerifyNow::requestAuthentication([
    'user_id' => auth()->id(),
    'verification_id' => $response['verification_id'],
]);

Using Services

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);

Add Verification to User Model

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 requires re-verification
$user->requiresReverification(365); // bool

// Get approval rate
$user->verificationApprovalRate(); // float (0-100)

// Authentication checks
$user->hasCompletedAuthentication(); // bool
$user->lastAuthenticationHasLiveness(); // bool
$user->lastAuthenticationFaceMatched(); // bool

Protect Routes

// 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
});

Listen to Events

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]);
});

Handle Webhooks

The package automatically handles VerifyNow webhooks at /api/webhooks/verifinow:

// Configure webhook in VerifyNow dashboard:
// Webhook URL: https://yourapp.com/api/webhooks/verifinow
// Events: verification.completed, verification.failed, etc.

Testing

Run the test suite:

./vendor/bin/pest

Run specific test file:

./vendor/bin/pest tests/Feature/WebhookTest.php

Generate coverage report:

./vendor/bin/pest --coverage

Database Schema

verifications Table

Stores verification requests and results:

  • id - Primary key
  • user_id - Associated user
  • verification_id - VerifyNow verification ID
  • type - Verification type (idv, authentication, age_verification)
  • country - Country code
  • status - Status (pending, processing, completed, failed)
  • result - Result (approved, rejected, pending)
  • confidence_score - Confidence score (0-100)
  • document_type - Document type used
  • metadata - Additional data
  • completed_at - Completion timestamp

verification_attempts Table

Tracks individual verification attempts:

  • id - Primary key
  • verification_id - Foreign key to verifications
  • attempt_number - Attempt sequence number
  • status - Attempt status
  • response_code - API response code
  • error_message - Error details if failed
  • response_data - Full API response
  • ip_address - Request IP
  • user_agent - Request user agent

user_authentications Table

Stores facial authentication results:

  • id - Primary key
  • verification_id - Foreign key to verifications
  • user_id - Associated user
  • authentication_id - VerifyNow authentication ID
  • status - Status (pending, processing, completed, failed)
  • result - Result (approved, rejected, pending)
  • confidence_score - Overall confidence
  • liveness_score - Liveness detection score
  • face_match_score - Face matching score
  • device_info - Device information
  • location_data - Location data
  • authenticated_at - Authentication timestamp

Configuration Options

All configuration options can be set via environment variables:

# API Configuration
VERIFINOW_API_KEY=          # Your VerifyNow API key (required)
VERIFINOW_BASE_URL=         # VerifyNow API base URL
VERIFINOW_WEBHOOK_SECRET=   # Webhook signature secret (required)
VERIFINOW_TIMEOUT=          # Request timeout in seconds (default: 30)

# Feature Flags
VERIFINOW_REGISTER_ROUTES=  # Auto-register webhook routes (default: true)
VERIFINOW_QUEUE_VERIFICATIONS=  # Queue verification jobs (default: false)
VERIFINOW_CACHE_VERIFICATIONS=  # Cache verification results (default: true)
VERIFINOW_CACHE_TTL=        # Cache TTL in seconds (default: 3600)

# Retry Configuration
VERIFINOW_RETRY_FAILED=     # Retry failed verifications (default: true)
VERIFINOW_MAX_RETRIES=      # Maximum retry attempts (default: 3)

# Logging
VERIFINOW_LOG_CHANNEL=      # Log channel (default: single)

Helper Functions

Convenient helper functions are available:

// 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');

Error Handling

The package throws specific exceptions for different scenarios:

use VerifyNow\Laravel\Exceptions\{
    VerifyNowException,
    UnauthorizedException,
    InvalidRequestException,
    DocumentValidationException,
    LivenessFailedException,
    FaceMismatchException,
};

try {
    VerifyNow::requestIDV($data);
} catch (UnauthorizedException $e) {
    // Invalid API key
} catch (InvalidRequestException $e) {
    // Invalid request data
} catch (DocumentValidationException $e) {
    // Document quality/format issue
} catch (LivenessFailedException $e) {
    // Liveness detection failed
} catch (FaceMismatchException $e) {
    // Face doesn't match document
} catch (VerifyNowException $e) {
    // Generic VerifyNow API error
}

Documentation

See the docs/ folder for complete documentation:

Support

For issues, questions, or contributions, please visit:

License

The MIT License (MIT). Please see License File for more information.

Contributing

Please see CONTRIBUTING.md for details.

Changelog

Please see CHANGELOG.md for details on what has changed recently.

verifinow/laravel 适用场景与选型建议

verifinow/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「identity」 「laravel」 「verification」 「facial-recognition」 「age-verification」 「idv」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 verifinow/laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 verifinow/laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 verifinow/laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-26