opportify/opportify-sdk-php

Opportify Insights PHP SDK

v0.2.6 2025-02-08 21:14 UTC

This package is auto-updated.

Last update: 2025-06-08 22:11:37 UTC


README

Tests Packagist Downloads Packagist Version License

Opportify-SDK-PHP

Overview

The Opportify Insights API provides access to a powerful and up-to-date platform. With advanced data warehousing and AI-driven capabilities, this API is designed to empower your business to make informed, data-driven decisions and effectively assess potential risks.

Sign Up Free

Base URL

Use the following base URL for all API requests:

https://api.opportify.ai/insights/v1/<service>/<endpoint>

Requirements

Requires PHP v8.1 or later.

Getting Started

First, install Opportify via the Composer package manager:

composer require opportify/opportify-sdk-php

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

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

Calling IP Insights

use Opportify\Sdk\IpInsights;

$ipInsights = new IpInsights("<YOUR-KEY-HERE>");

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

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

Enabling Debug Mode

$clientInsights->setDebugMode(true);

Handling Error

We strongly recommend that any usage of this SDK happens within a try-catch to properly handle any exceptions or errors.

use OpenAPI\Client\ApiException;

try {
    
    // Email or IP Insights usage...

} catch (ApiException $e) {
    throw new \Exception($e->getResponseBody());
}

Below are the ApiException functions available:

Function Type Value Sample
$e->getMessage(); string "[403] Client error: POST https://api.opportify.ai/insights/v1/... resulted in a 403 Forbidden"
$e->getResponseBody(); string "{"errorMessage":"Your plan does not support AI features, please upgrade your plan or set enableAI as false.","errorCode":"INVALID_PLAN"}"
$e->getCode(); integer 403

About this package

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