Download the PHP package sendaramail/sendara without Composer
On this page you can find all versions of the php package sendaramail/sendara. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sendaramail/sendara
More information about sendaramail/sendara
Files in sendaramail/sendara
Package sendara
Short Description Sendara — email & marketing API (transactional email, broadcasts, contacts, templates, webhooks) for PHP. Zero runtime dependencies.
License MIT
Homepage https://sendara.dev
Informations about the package sendara
Sendara PHP SDK
The official PHP SDK for the Sendara email API. Send transactional email, run broadcasts, page through your message history, and verify webhooks — with zero runtime dependencies (just ext-curl and ext-json).
Requires PHP 8.1+.
Installation
Quickstart
Create a client with your API key, then send an email:
The resource accessors are also exposed as lazy, memoized properties, so $client->emails is equivalent to $client->emails().
Client options
The second constructor argument is an options array. All fields are optional:
The client automatically:
- Sends
Authorization: Bearer <apiKey>. - JSON-encodes request bodies.
- Adds an
Idempotency-Keyto every write (POST/PUT/PATCH) request. - Retries idempotent requests on
429and5xxresponses (and network failures) with exponential backoff, honoringRetry-After.
Send options
emails()->send() accepts these keys:
| Key | Type | Description |
|---|---|---|
to |
string (required) | Recipient address. |
from |
string | Sender address. Required after you verify your own domain; sandbox onboarding uses Sendara's shared sender. |
subject |
string | Email subject. |
html |
string | HTML body. |
text |
string | Plain-text body. |
templateId |
string | Render a stored template instead of inline body. |
templateVars |
array | Variables for the template. |
messageType |
string | Message type tag. |
metadata |
array | Arbitrary metadata stored with the message. |
storePayload |
bool | Store the content payload for later inspection. |
testSend |
bool | Use the verified test-recipient path without billing. |
scheduledAt |
string | ISO 8601 time for a send at least one minute in the future. |
validateRecipient |
bool | Validate the address before provider dispatch. |
idempotencyKey |
string | Supply your own key; one is generated if omitted. |
For full control over the request body, use the escape hatch:
Broadcasts
Create, send, and manage broadcasts to a list or an explicit recipient set:
List, fetch, cancel, and delete:
Create and fan out in a single call with bulkSend():
create() accepts name, fromEmail, subject, bodyHtml, bodyText,
templateId, messageType, audienceListId, listIds, excludeListIds,
recipients, scheduledAt, and sendNow. bulkSend() accepts the same content
and audience fields but always fans out immediately, so it does not accept
scheduledAt or sendNow.
Pass listIds to send to several contact lists at once, and excludeListIds to
subtract a list from that audience.
Billing checkout
Checkout accepts starter, pro, growth, or scale, with a month or
year billing period. It returns a CheckoutResult for both successful
outcomes:
Messages and pagination
Fetch a single page, including the cursor for the next one:
Or let the SDK walk every page for you. list() returns a Generator that auto-paginates through next_cursor:
page() and list() accept the same filters: status, search, from, to, limit, cursor.
Fetch a single message with its full event timeline, by id or by the idempotency key from the original send:
Webhook verification
Verify the authenticity of an inbound webhook with Sendara\Webhooks::verify(). Pass the raw request body (the exact bytes received — never a re-encoded object), the request headers, and your signing secret. On success it returns the decoded JSON payload; on failure it throws WebhookVerificationException.
Verification recomputes HMAC-SHA256(secret, "<timestamp>.<rawBody>") and compares it in constant time against the Sendara-Signature header. It also rejects requests whose Sendara-Timestamp falls outside a tolerance window (default 300 seconds). Pass a fourth argument to change the tolerance, or 0 to disable the timestamp check:
Headers are matched case-insensitively, so framework-normalized header maps work as-is.
Error handling
Every non-2xx response throws Sendara\Exception\ApiException, which extends Sendara\Exception\SendaraException. The API's { "error": { "code", "message" } } envelope is decoded onto the exception:
Catch ApiException for failed API calls, and SendaraException to also cover client-side problems such as a missing API key, JSON encoding failures, or network errors that exhausted retries.
Laravel
The package ships a service provider and facade and is auto-discovered — no manual registration needed.
Set your credentials in .env:
Optionally publish the config file to config/sendara.php:
Use the Sendara facade anywhere:
The underlying Sendara\Client is bound as a singleton, so you can also resolve it via dependency injection:
The facade and client expose the same resources: emails, broadcasts, messages, contacts, lists, domains, templates, suppressions, usage, apiKeys, and billing.
License
MIT
All versions of sendara with dependencies
ext-curl Version *
ext-json Version *