isend-ai/php-sdk

PHP SDK for isend.ai - Send emails easily using email connectors like SES, SendGrid, and more

dev-main 2025-07-06 15:55 UTC

This package is not auto-updated.

Last update: 2025-07-07 14:54:59 UTC


README

A simple PHP SDK for sending emails through isend.ai using various email connectors like AWS SES, SendGrid, Mailgun, and more.

Installation

composer require isend-ai/php-sdk

Quick Start

<?php

require_once 'vendor/autoload.php';

use ISend\ISendClient;

// Initialize the client
$client = new ISendClient('your-api-key-here');

// Send email using template
$emailData = [
    'template_id' => 124,
    'to' => 'hi@isend.ai',
    'dataMapping' => [
        'name' => 'ISend'
    ]
];

$response = $client->sendEmail($emailData);

print_r($response);

Usage

Send Email Using Template

$emailData = [
    'template_id' => 124,
    'to' => 'hi@isend.ai',
    'dataMapping' => [
        'name' => 'ISend'
    ]
];

$response = $client->sendEmail($emailData);

API Reference

IsendClient

Constructor

new ISendClient(string $apiKey, array $config = [])

Methods

sendEmail(array $emailData): array

Sends an email using the provided template and data.

Parameters:

  • $emailData (array): Email data including:
    • template_id (int): The template ID to use
    • to (string): Recipient email address
    • dataMapping (array): Data mapping for template variables

Error Handling

The SDK throws Exception for any errors:

try {
    $response = $client->sendEmail([
        'template_id' => 124,
        'to' => 'hi@isend.ai',
        'dataMapping' => [
            'name' => 'ISend'
        ]
    ]);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

Examples

See the examples/ directory for complete usage examples.

Requirements

  • PHP 5.6 or higher
  • cURL extension enabled

License

MIT License