duta/duta-php
Composer 安装命令:
composer require duta/duta-php
包简介
Official PHP SDK for Duta — transactional email for developers.
README 文档
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
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-14