PHP SDK
The official PHP client. Uses cURL, no third-party dependencies.
Install
Section titled “Install”composer require duta/duta-phprequire 'vendor/autoload.php';
$duta = new \Duta\Client('duta_live_xxx');
$result = $duta->emails->send([ 'from' => 'hello@yourdomain.com', 'to' => 'user@example.com', 'subject' => 'Welcome', 'html' => '<p>Thanks for signing up!</p>',]);
echo "Sent: " . $result['id'];Error handling
Section titled “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 | ...}Methods
Section titled “Methods”$duta->emails->send($params): send an email. Keys:from,to(string or array),subject,html,text,reply_to,tags.$duta->emails->get($id): retrieve an email. Requires a full-access key.$duta->emails->list($page = 1, $limit = 20): list emails. Requires a full-access key.
Package: packagist.org/packages/duta/duta-php · Source: github.com/indra-sh/duta-php.