duta/duta-php

Official PHP SDK for Duta — transactional email for developers.

Maintainers

Package info

github.com/indra-sh/duta-php

Homepage

pkg:composer/duta/duta-php

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.6 2026-06-15 15:34 UTC

This package is auto-updated.

Last update: 2026-06-15 16:02:57 UTC


README

Official PHP client for Duta. Uses cURL, no third-party dependencies.

Install

composer require duta/duta-php

Quickstart

require 'vendor/autoload.php';

$duta = new \Duta\Client('duta_live_xxx');

$result = $duta->emails->send([
    'from' => 'hello@yourdomain.com',
    'to' => 'user@example.com',
    'subject' => 'Welcome to Duta',
    'html' => '<p>Thanks for signing up!</p>',
]);

echo "Sent: " . $result['id'];

Get an API key from the dashboard. The sender domain must be verified first.

Error handling

Methods throw \Duta\DutaException on failure:

use Duta\DutaException;

try {
    $duta->emails->send([ /* ... */ ]);
} catch (DutaException $e) {
    echo $e->statusCode . ' ' . $e->name . ': ' . $e->getMessage();
    // $e->name: authentication_error | permission_denied | rate_limit_exceeded | ...
}

API

new \Duta\Client(string $apiKey, string $baseUrl = ..., int $timeout = 30)

$duta->emails->send(array $params)

$params keys: from, to (string or array), subject, html, text, reply_to, tags (assoc array). Returns an array with id and status.

$duta->emails->get(string $id)

Retrieve one email. Requires a full-access API key.

$duta->emails->list(int $page = 1, int $limit = 20)

List emails, newest first. Requires a full-access API key.

License

MIT