Official SDK Documentation

PHP SDK

Official PHP SDK for the NexMailPro Email Validation API.

Published package details

Composer package

nexmailpro/php-sdk

Client class

NexMailPro\PhpSdk\Client

Verify method

verifyEmail()

PHP requirement

^8.2

Namespace

NexMailPro\PhpSdk

Public API

verifyEmail(string $email, array $payload = []): array

PHP

NexMailPro SDK

Composer-first integration for email verification

Wraps the live POST /api/v1/verify/email endpoint.
Adds JSON request handling, default headers, and API error exceptions.
Works well for backend services, Laravel apps, CRM connectors, and signup workflows.

1. Installation

Install the official package from Packagist with Composer. This adds the SDK and enables PSR-4 autoloading in your project.

composer require nexmailpro/php-sdk

2. Initialize Client

The published README loads Composer autoloading first, then instantiates NexMailPro\PhpSdk\Client with your API key.

<?php

require __DIR__ . '/vendor/autoload.php';

use NexMailPro\PhpSdk\Client;

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

3. Verify Email

The only public verification method currently published is verifyEmail(string $email, array $payload = []): array. The README example passes an optional payload array alongside the email address.

$response = $client->verifyEmail('[email protected]', [
    'source' => 'signup-form',
]);

var_dump($response);

4. Example Response

Successful SDK calls return the same JSON structure documented for the live API.

{
  "success": true,
  "message": "Verification completed",
  "data": {
    "email": "[email protected]",
    "status": "valid",
    "sub_status": "deliverable",
    "score": 90,
    "is_syntax_valid": true,
    "has_mx": true,
    "domain_exists": true
  },
  "meta": {
    "credits_charged": 1
  }
}

5. Error Handling

The published SDK exposes two exception classes: NexMailPro\PhpSdk\Exception\ApiException and NexMailPro\PhpSdk\Exception\NexMailProException.

use NexMailPro\PhpSdk\Client;
use NexMailPro\PhpSdk\Exception\ApiException;
use NexMailPro\PhpSdk\Exception\NexMailProException;

$client = new Client(apiKey: 'YOUR_API_KEY');

try {
    $result = $client->verifyEmail('[email protected]');
} catch (ApiException $e) {
    error_log(sprintf(
        'NexMailPro API error [%d]: %s',
        $e->statusCode(),
        $e->responseBody()
    ));
} catch (NexMailProException $e) {
    error_log($e->getMessage());
}

6. Features

✓ Composer Ready

Install the package with a single Composer command and autoload it in any PHP project.

✓ PSR-4 Autoloading

The published package uses PSR-4 autoloading with the NexMailPro\\PhpSdk namespace.

✓ Exception Handling

Catch API and SDK exceptions separately so your application can respond cleanly to failures.

✓ Lightweight

The SDK focuses on email verification without adding a large dependency tree.

✓ PHP 8.2+

The current Packagist release requires modern PHP and ships typed code throughout the client.

✓ Production Ready

Use the same JSON responses and authentication model documented for the live NexMailPro API.

7. Requirements

PHP Version

PHP 8.2 or newer is required by the published package.

Composer

Composer installs the package and manages PSR-4 autoloading in your application.

Internet Connection

Your server must be able to send outbound HTTPS requests to NexMailPro API endpoints.

API Key

Create an API key in your NexMailPro dashboard and keep it in a secure environment variable.

9. FAQ

How do I install the NexMailPro PHP SDK? +

Install the package with Composer by running composer require nexmailpro/php-sdk from your PHP project.

What PHP version does the published SDK require? +

The current Packagist release requires PHP 8.2 or newer.

Which client class and method should I use? +

The published package currently exposes NexMailPro\PhpSdk\Client and uses the verifyEmail method for single email verification requests.

How should I handle API and transport errors? +

Catch NexMailPro\PhpSdk\Exception\ApiException for non-2xx API responses and NexMailPro\PhpSdk\Exception\NexMailProException for SDK-level failures such as invalid payload or response handling issues.

Need help?

10. Need Help

Review the REST API reference, inspect the open-source SDK, or contact NexMailPro support if you need help getting your PHP integration into production.