PHPackages                             opportify/opportify-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. opportify/opportify-sdk-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

opportify/opportify-sdk-php
===========================

Opportify Insights PHP SDK

1.0.0(1mo ago)03.4k↑275.6%MITPHPPHP &gt;=8.1.0CI passing

Since Dec 20Pushed 1mo agoCompare

[ Source](https://github.com/opportify/opportify-sdk-php)[ Packagist](https://packagist.org/packages/opportify/opportify-sdk-php)[ RSS](/packages/opportify-opportify-sdk-php/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (8)Versions (27)Used By (0)

[![Tests](https://camo.githubusercontent.com/bca543439d9be896d8e165fd6636a8f180a1943d5ecf138f7abccc4001010d20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f70706f72746966792f6f70706f72746966792d73646b2d7068702f706870756e69742e796d6c3f6c6162656c3d7465737473267374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d313135653563)](https://github.com/opportify/opportify-sdk-php/actions/workflows/phpunit.yml)[![Packagist Downloads](https://camo.githubusercontent.com/329a17858f0435aeff7483d97923dd7f95dee9ed21b26ddd119cf71e2fb947f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70706f72746966792f6f70706f72746966792d73646b2d7068703f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d313135653563)](https://packagist.org/packages/opportify/opportify-sdk-php)[![Packagist Version](https://camo.githubusercontent.com/9d12090d9300ae8175cef1525641e7dfc0a4b1bd145156b4bd08fae52e256a0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70706f72746966792f6f70706f72746966792d73646b2d7068703f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d313135653563)](https://packagist.org/packages/opportify/opportify-sdk-php)[![License](https://camo.githubusercontent.com/efadaaf8d578f1fc39ac3d9dcbb3447f95d4c14f3b7559ca3d026589471eba57/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f70706f72746966792f6f70706f72746966792d73646b2d7068703f636f6c6f723d396366267374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d313135653563)](https://github.com/opportify/opportify-sdk-php/blob/main/LICENSE)

Opportify-SDK-PHP
=================

[](#opportify-sdk-php)

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Requirements](#requirements)
- [Getting Started](#getting-started)
    - [Calling Email Insights](#calling-email-insights)
    - [Calling IP Insights](#calling-ip-insights)
    - [Calling Fraud Protection](#calling-fraud-protection)
- [Batch Analysis (Email &amp; IP)](#batch-analysis-email--ip)
    - [Batch Email Analysis (JSON)](#1-batch-email-analysis-json)
    - [Batch Email Analysis (Plain Text)](#2-batch-email-analysis-plain-text)
    - [Batch Email Analysis (File Upload)](#3-batch-email-analysis-file-upload)
    - [Batch IP Analysis (JSON)](#4-batch-ip-analysis-json)
    - [Batch IP Analysis (Plain Text)](#5-batch-ip-analysis-plain-text)
    - [Batch IP Analysis (File Upload)](#6-batch-ip-analysis-file-upload)
- [Batch Export Jobs](#batch-export-jobs)
    - [Email Batch Exports](#email-batch-exports)
    - [IP Batch Exports](#ip-batch-exports)
- [Enabling Debug Mode](#enabling-debug-mode)
- [Handling Errors](#handling-errors)
- [About this package](#about-this-package)

Overview
--------

[](#overview)

The **Opportify SDK** gives your PHP application access to the full Opportify platform:

ProductPurpose**Email Insights**Validate, enrich, and score email addresses**IP Insights**Geolocate, enrich, and assess risk for IP addresses**Fraud Protection**Analyze form submissions for fraud risk across email, IP, geo, session, and velocity signalsAll products share a common API key and the same SDK installation.

[Sign Up Free](https://www.opportify.ai)

### Base URLs

[](#base-urls)

ProductBase URLEmail &amp; IP Insights`https://api.opportify.ai/insights/v1/`Fraud Protection`https://api.opportify.ai/intel/v1/`Requirements
------------

[](#requirements)

Requires PHP [v8.1 or later](https://www.php.net/releases).

Getting Started
---------------

[](#getting-started)

First, install Opportify via the Composer package manager:

```
composer require opportify/opportify-sdk-php
```

### Calling Email Insights

[](#calling-email-insights)

```
use Opportify\Sdk\EmailInsights;

$emailInsights = new EmailInsights("YOUR-API-KEY-HERE");

$params = [
    "email" => "test@gmial.com", // *gmial* - just an example to be auto-corrected
    "enableAi" => true,
    "enableAutoCorrection" => true,
    "enableDomainEnrichment" => true // Optional: include domain enrichment block
];

$result = $emailInsights->analyze($params);
```

### Calling IP Insights

[](#calling-ip-insights)

```
use Opportify\Sdk\IpInsights;

$ipInsights = new IpInsights("");

$params = [
    "ip" => "3.1.122.82",
    "enableAi" => true
];

$result = $ipInsights->analyze($params);
```

### Calling Fraud Protection

[](#calling-fraud-protection)

Analyze a form submission for fraud risk. The response provides an overall risk score with a breakdown by signal source (email, IP, geo, session, velocity).

```
use Opportify\Sdk\FraudProtection;

$fraudProtection = new FraudProtection("");

$params = [
    // Identity
    "email"          => "user@example.com",
    "firstName"      => "Jane",
    "lastName"       => "Doe",
    "username"       => "jane_doe",
    "companyName"    => "Acme Corp",

    // Network
    "userIp"         => "3.1.122.82",

    // Contact details
    "phone1"         => "+1-800-555-0100",
    "website"        => "https://acme.example.com",

    // Submission context
    "subject"        => "Contact form submission",
    "message"        => "Hello, I am interested in your service.",
    "submissionType" => "contact",  // e.g. "contact", "signup", "checkout"
    "origin"         => "yoursite.com",  // hostname only — no protocol, path, or port

    // Address (all optional)
    "address1"       => "123 Main St",
    "city"           => "Springfield",
    "region"         => "IL",
    "country"        => "US",
    "postalCode"     => "62701",

    // Token & form tracking (optional)
    "opportifyToken"   => "opportify-generated-token",
    "opportifyFormUUID" => "uuid-of-the-form",

    // Raw form fields as key-value pairs (optional)
    "formData"       => ["custom_field" => "value"],
];

$result = $fraudProtection->analyze($params);
// $result->score    — integer 200–1000 (higher = riskier)
// $result->level    — "lowest" | "low" | "medium" | "high" | "highest"
// $result->factors  — string[] of detected risk signals
// $result->sources  — per-signal breakdown (email, IP, geo, session, velocity)
```

All parameter names accept both `snake_case` and `camelCase` (e.g. `user_ip` or `userIp`).

Batch Analysis (Email &amp; IP)
-------------------------------

[](#batch-analysis-email--ip)

You can submit multiple emails or IPs in a single request. Batch jobs are processed asynchronously; the response returns a job identifier (`jobId`) you can poll for status.

#### 1. Batch Email Analysis (JSON)

[](#1-batch-email-analysis-json)

```
use Opportify\Sdk\EmailInsights;

$emailInsights = new EmailInsights("");

$params = [
    'emails' => [
        'one@example.com',
        'two@example.org'
    ],
    'name' => 'Customer Email Validation', // Optional: descriptive name for the job
    'enableAi' => true,
    'enableAutoCorrection' => true
];

// Default content type is application/json
$batch = $emailInsights->batchAnalyze($params);

// Optional: poll status later
$status = $emailInsights->getBatchStatus($batch->jobId);
```

#### 2. Batch Email Analysis (Plain Text)

[](#2-batch-email-analysis-plain-text)

Provide one email per line and set the content type to `text/plain`.

```
$content = "one@example.com\nTwo.User@example.org"; // newline-delimited emails
$batch = $emailInsights->batchAnalyze(['text' => $content], 'text/plain');
$status = $emailInsights->getBatchStatus($batch->jobId);
```

#### 3. Batch Email Analysis (File Upload)

[](#3-batch-email-analysis-file-upload)

Supply a `.csv` (one email per row; header optional) via `batchAnalyzeFile()`. A `.csv` triggers `multipart/form-data`; other extensions fall back to `text/plain` (newline-delimited body).

```
$batch = $emailInsights->batchAnalyzeFile(__DIR__.'/emails.csv', [
    'name' => 'Monthly Email Cleanup', // Optional: descriptive name for the job
    'enableAi' => true,
    'enableAutoCorrection' => true
]);
$status = $emailInsights->getBatchStatus($batch->jobId);
```

#### 4. Batch IP Analysis (JSON)

[](#4-batch-ip-analysis-json)

```
use Opportify\Sdk\IpInsights;

$ipInsights = new IpInsights("");

$params = [
    'ips' => [
        '1.1.1.1',
        '8.8.8.8'
    ],
    'name' => 'Network Security Scan', // Optional: descriptive name for the job
    'enableAi' => true
];

$batch = $ipInsights->batchAnalyze($params); // application/json
$status = $ipInsights->getBatchStatus($batch->jobId);
```

#### 5. Batch IP Analysis (Plain Text)

[](#5-batch-ip-analysis-plain-text)

```
$content = "1.1.1.1\n8.8.8.8"; // newline-delimited IPs
$batch = $ipInsights->batchAnalyze(['text' => $content], 'text/plain');
$status = $ipInsights->getBatchStatus($batch->jobId);
```

#### 6. Batch IP Analysis (File Upload)

[](#6-batch-ip-analysis-file-upload)

```
$batch = $ipInsights->batchAnalyzeFile(__DIR__.'/ips.csv', [
    'name' => 'Firewall IP Assessment', // Optional: descriptive name for the job
    'enableAi' => true
]);
$status = $ipInsights->getBatchStatus($batch->jobId);
```

#### Convenience &amp; Notes

[](#convenience--notes)

- `batchAnalyzeFile()` auto-selects content type: `.csv` -&gt; `multipart/form-data`; otherwise `text/plain`.
- For `text/plain`, pass newline-delimited values via the `text` key.
- For `multipart/form-data`, pass a readable file path via the `file` key (handled internally by `batchAnalyzeFile()`).
- The `name` parameter is optional for all batch operations and helps with job identification and tracking.
- `enableAutoCorrection` applies only to Email Insights.
- Always wrap calls in a try-catch (see Error Handling) to capture API errors.
- Polling cadence depends on payload size; a short delay (1–3s) between status checks is recommended.

Batch Export Jobs
-----------------

[](#batch-export-jobs)

Use batch exports to materialize filtered results from completed jobs. Exports run asynchronously and expose polling helpers similar to batch status checks.

### Email Batch Exports

[](#email-batch-exports)

```
$emailInsights = new EmailInsights('');

// Trigger a new export for a completed batch job
$export = $emailInsights->createBatchExport('job-uuid-here', [
    'exportType' => 'csv',
    'columns' => [
        'emailAddress',
        'emailProvider',
        'riskReport.score',
        'isDeliverable'
    ],
    'filters' => [
        'isDeliverable' => 'true',
        'riskReport.score' => ['min' => 400]
    ]
]);

// Poll until the export is ready
$status = $emailInsights->getBatchExportStatus('job-uuid-here', $export->exportId);

if ($status->status === 'COMPLETED') {
    // Use $status->downloadUrl for the pre-signed file link
}
```

### IP Batch Exports

[](#ip-batch-exports)

```
$ipInsights = new IpInsights('');

$export = $ipInsights->createBatchExport('job-uuid-here', [
    'exportType' => 'json',
    'columns' => [
        'result.ipAddress',
        'result.connectionType',
        'result.riskReport.score'
    ],
    'filters' => [
        'result.riskReport.level' => ['low', 'medium']
    ]
]);

$status = $ipInsights->getBatchExportStatus('job-uuid-here', $export->exportId);

if ($status->status === 'COMPLETED') {
    // Use $status->downloadUrl to retrieve the generated export
} elseif ($status->status === 'FAILED') {
    // Review $status->errorCode and $status->errorMessage for remediation guidance
}
```

Enabling Debug Mode
-------------------

[](#enabling-debug-mode)

All wrappers support debug mode, which enables verbose HTTP logging via Guzzle:

```
$emailInsights->setDebugMode(true);
$ipInsights->setDebugMode(true);
$fraudProtection->setDebugMode(true);
```

You can also override the host, API prefix, or version for testing against staging environments:

```
$fraudProtection->setHost('https://staging.api.opportify.ai');
$fraudProtection->setVersion('v2');
$fraudProtection->setPrefix('intel');
```

Handling Errors
---------------

[](#handling-errors)

We strongly recommend wrapping all SDK calls in a try-catch to handle API errors.

**Email Insights &amp; IP Insights** use `OpenAPI\Client\ApiException`:

```
use OpenAPI\Client\ApiException;

try {
    $result = $emailInsights->analyze($params);
    // or: $result = $ipInsights->analyze($params);
} catch (ApiException $e) {
    throw new \Exception($e->getResponseBody());
}
```

**Fraud Protection** uses its own namespace `OpenAPI\FraudIntel\Client\ApiException`:

```
use OpenAPI\FraudIntel\Client\ApiException;

try {
    $result = $fraudProtection->analyze($params);
} catch (ApiException $e) {
    throw new \Exception($e->getResponseBody());
}
```

All `ApiException` instances expose the same interface:

MethodTypeExample`$e->getMessage()`string`"[403] Client error: POST https://api.opportify.ai/... resulted in a 403 Forbidden"``$e->getResponseBody()`string`'{"errorMessage":"Your plan does not support AI features","errorCode":"INVALID_PLAN"}'``$e->getCode()`integer`403`About this package
------------------

[](#about-this-package)

This PHP package is a customization of the base generated by:

- [OpenAPI Generator](https://openapi-generator.tech) project.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance90

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~45 days

Total

22

Last Release

52d ago

Major Versions

v0.8.1 → 1.0.02026-05-12

PHP version history (2 changes)0.1.0PHP &gt;=7.4

v0.2.2PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3472b0f4175ee7bcc269b8634bd9b79d4b7a401a4afa13f53de71711569e231d?d=identicon)[opportify](/maintainers/opportify)

---

Top Contributors

[![opportify-bb](https://avatars.githubusercontent.com/u/191276444?v=4)](https://github.com/opportify-bb "opportify-bb (36 commits)")

---

Tags

phpapiclientvalidationsdkemailInsightsIPverificationopportify

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/opportify-opportify-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/opportify-opportify-sdk-php/health.svg)](https://phpackages.com/packages/opportify-opportify-sdk-php)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

15130.8k](/packages/hafael-azure-mailer-driver)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
