Packagist
nateq/sdk
GitHub
Source and issues
Requirements
- PHP 8.2 or newer
ext-curlandext-json- Laravel 11 or 12 (optional — the SDK works without it)
Install
Nateq facade are auto-discovered. There’s
nothing to register.
Quickstart
Create an API key with theemails:send scope, then put it in your environment:
Authentication
The SDK readsNATEQ_API_KEY by default. Pass it explicitly to load it from a
secret manager, or to talk to more than one organization:
Sending email
send() returns once the API accepts the message. Delivery happens afterwards —
a successful return means Nateq took responsibility for it, not that it landed.
htmlBody, plainTextBody, or both. Omit fromEmail and
emailAddressId to use your organization’s default verified address.
Reading email
EmailStatus is an enum with helpers, so you don’t have to memorise which of the
nine statuses count as success:
limit defaults to 50 and is capped at 100.
The API returns more fields than the SDK models. Anything not promoted to a
property is still on
$email->raw, so a new field works without an SDK upgrade.Errors
Everything extendsNateqException, so one catch covers the surface:
See Errors for the underlying API codes.
Retries and duplicate sends
Reads (get, list) retry automatically on timeouts, 5xx, and connection
failures, with exponential backoff that honours Retry-After.
send() does not. The API has no idempotency key, so a send that fails
after reaching the server may already have gone out. Replaying it could mail
your customer twice, and the SDK won’t make that call for you.
The exception is a 429, which the API raises before anything is sent — so it
is retried, because a duplicate is impossible.
If a send() throws TimeoutException or ServerException, the outcome is
genuinely unknown. Look it up before retrying:
Laravel
Publish the config only if you want to edit it:Send from a queued job
Email is a network call to a third party. Doing it inline ties your response time to ours.NATEQ_API_KEY and nothing happens, you have a cached config:
Testing
Don’t hit the API from your test suite. ImplementHttpClient with a fake: