承接 emailverify-ai/php-sdk 相关项目开发

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

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

emailverify-ai/php-sdk

最新稳定版本:v1.0.1

Composer 安装命令:

composer require emailverify-ai/php-sdk

包简介

Official EmailVerify PHP SDK for email verification

README 文档

README

Official EmailVerify PHP SDK for email verification.

Documentation: https://emailverify.ai/docs

Requirements

  • PHP 8.1 or higher
  • Composer

Installation

composer require emailverify/php-sdk

Quick Start

<?php

require 'vendor/autoload.php';

use EmailVerify\Client;

$client = new Client('your-api-key');

// Verify a single email
$result = $client->verify('user@example.com');
echo $result['status']; // 'valid', 'invalid', 'unknown', or 'accept_all'

Configuration

$client = new Client(
    apiKey: 'your-api-key',        // Required
    baseUrl: 'https://api.emailverify.ai/v1',  // Optional
    timeout: 30,                    // Optional: Request timeout in seconds (default: 30)
    retries: 3                      // Optional: Number of retries (default: 3)
);

Single Email Verification

$result = $client->verify(
    email: 'user@example.com',
    smtpCheck: true,  // Optional: Perform SMTP verification (default: true)
    timeout: 5000     // Optional: Verification timeout in ms
);

echo $result['email'];                    // 'user@example.com'
echo $result['status'];                   // 'valid'
echo $result['score'];                    // 0.95
echo $result['result']['deliverable'];    // true
echo $result['result']['disposable'];     // false

Bulk Email Verification

// Submit a bulk verification job
$job = $client->verifyBulk(
    emails: ['user1@example.com', 'user2@example.com', 'user3@example.com'],
    smtpCheck: true,
    webhookUrl: 'https://your-app.com/webhooks/emailverify'  // Optional
);

echo $job['job_id'];  // 'job_abc123xyz'

// Check job status
$status = $client->getBulkJobStatus($job['job_id']);
echo $status['progress_percent'];  // 45

// Wait for completion (polling)
$completed = $client->waitForBulkJobCompletion(
    jobId: $job['job_id'],
    pollInterval: 5,  // seconds
    maxWait: 600      // seconds
);

// Get results
$results = $client->getBulkJobResults(
    jobId: $job['job_id'],
    limit: 100,
    offset: 0,
    status: 'valid'  // Optional: filter by status
);

foreach ($results['results'] as $item) {
    echo "{$item['email']}: {$item['status']}\n";
}

Credits

$credits = $client->getCredits();

echo $credits['available'];                  // 9500
echo $credits['plan'];                       // 'Professional'
echo $credits['rate_limit']['remaining'];    // 9850

Webhooks

// Create a webhook
$webhook = $client->createWebhook(
    url: 'https://your-app.com/webhooks/emailverify',
    events: ['verification.completed', 'bulk.completed'],
    secret: 'your-webhook-secret'
);

// List webhooks
$webhooks = $client->listWebhooks();

// Delete a webhook
$client->deleteWebhook($webhook['id']);

// Verify webhook signature
$isValid = Client::verifyWebhookSignature(
    payload: $rawBody,
    signature: $signatureHeader,
    secret: 'your-webhook-secret'
);

Error Handling

use EmailVerify\Client;
use EmailVerify\Exception\AuthenticationException;
use EmailVerify\Exception\RateLimitException;
use EmailVerify\Exception\ValidationException;
use EmailVerify\Exception\InsufficientCreditsException;
use EmailVerify\Exception\NotFoundException;
use EmailVerify\Exception\TimeoutException;
use EmailVerify\Exception\EmailVerifyException;

try {
    $result = $client->verify('user@example.com');
} catch (AuthenticationException $e) {
    echo "Invalid API key\n";
} catch (RateLimitException $e) {
    echo "Rate limited. Retry after {$e->getRetryAfter()} seconds\n";
} catch (ValidationException $e) {
    echo "Invalid input: {$e->getMessage()}\n";
    echo "Details: {$e->getDetails()}\n";
} catch (InsufficientCreditsException $e) {
    echo "Not enough credits\n";
} catch (NotFoundException $e) {
    echo "Resource not found\n";
} catch (TimeoutException $e) {
    echo "Request timed out\n";
} catch (EmailVerifyException $e) {
    echo "Error [{$e->getErrorCode()}]: {$e->getMessage()}\n";
}

Webhook Events

Available webhook events:

  • verification.completed - Single email verification completed
  • bulk.completed - Bulk job finished
  • bulk.failed - Bulk job failed
  • credits.low - Credits below threshold

Verification Status Values

  • valid - Email exists and can receive messages
  • invalid - Email doesn't exist or can't receive messages
  • unknown - Could not determine validity with certainty
  • accept_all - Domain accepts all emails (catch-all)

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-07