Download the PHP package s-mailer/sdk without Composer
On this page you can find all versions of the php package s-mailer/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sdk
S-Mailer PHP SDK
PHP SDK for the S-Mailer API — send messages across SMS, email, WhatsApp and more, list sent/received messages, check your balance, and verify webhooks.
Status: pre-1.0. All resource methods are implemented; the API may still change before
1.0.0.
Requirements
- PHP 8.1+
- A PSR-18 HTTP client and PSR-17 factories (e.g. Guzzle). They are auto-discovered via
php-http/discovery; you can also inject your own (see Configuration).
Installation
If you don't already have a PSR-18 client installed:
Authentication
Every request authenticates with your X-Client-ID / X-Client-Secret pair. Find them in your S-Mailer dashboard.
Usage
Send a message
List and fetch messages
Retrigger / delete
Balance, profile, channels
WhatsApp advanced (media, buttons, location, contact, reactions)
For WhatsApp senders only. Text is billed at the outbound cost; media/buttons/location/contact/reactions at the advanced cost.
Configuration
Pass a third $options array to tune the client:
Retries use an exponential backoff and honour a Retry-After header on 429.
Webhooks
S-Mailer signs every webhook it sends with X-Mailer-Signature: hex(HMAC-SHA256(webhook_signing_key, raw_body)). Your webhook_signing_key comes from GET /api/v1/client ($mailer->balance->profile()). Verify over the raw request body, before decoding it.
Two payload shapes are delivered, distinguished by their fields:
- Inbound:
{ id, from, to, channel, body, received_at, sender_id, client_id, payment_required } - Status:
{ message_id, recipient, status: { old, current }, error_code, timestamp }
Errors
Non-2xx responses raise a \SMailer\Exception\SMailerException subclass carrying the API error code (->errorCode) and HTTP status (->statusCode):
| Status | Exception (\SMailer\Exception\…) |
error |
|---|---|---|
| 401 | AuthenticationException |
AUTHENTICATION_FAILED |
| 403 | ForbiddenException |
FORBIDDEN |
| 400 | BadRequestException / ValidationException |
BAD_REQUEST / VALIDATION_ERROR |
| 402 | InsufficientTokensException |
INSUFFICIENT_TOKENS |
| 404 | NotFoundException |
NOT_FOUND |
| 429 | RateLimitException (->retryAfter) |
RATE_LIMIT_EXCEEDED |
| 5xx | ServerException |
INTERNAL_SERVER_ERROR |
Network/transport failures raise NetworkException.
License
MIT — see LICENSE.
All versions of sdk with dependencies
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0