Skip to main content
Use the PHP SDK when your application needs Composer packages for one or more Sendmux API surfaces.
Sending clients accept a send-capable smx_mbx_ key or owner-approved Sending-resource smx_agent_ token. Mailbox clients accept smx_mbx_ keys or scoped smx_agent_ tokens. Management clients require team-scoped smx_root_ keys.

Requirements

  • PHP 8.2 or newer.
  • Composer.
  • A Sendmux API key for the surface you are calling.

Install

Install the umbrella package when one application needs more than one API surface.

Create a client

PHP packages expose factory methods for each generated API group.

Choose a surface

Pre-claim smx_agent_ tokens are mailbox-compatible only. Owner-approved Sending-resource smx_agent_ tokens can send. Pre-claim self-registered agent tokens include mailbox.read and email.receive, not email.send.
Sending uses https://smtp.sendmux.ai/api/v1 by default. Mailbox and Management use https://app.sendmux.ai/api/v1.

Shared API behaviour

Surface factories validate API key prefixes, configure bearer auth, and add retry middleware to generated API clients.

Pagination

List responses use cursor pagination with pagination.has_more and pagination.next_cursor. The core package exports Pagination::iterate() for cursor iteration when you wrap a page-fetching function.

Retries and rate limits

Surface clients use RetryMiddleware::create() by default. It retries safe methods and retry-safe POST requests that include Idempotency-Key, then honours Retry-After and X-RateLimit-Reset response headers. Pass RetryOptions into a factory method to change attempts, delays, or jitter.

Idempotency and ETags

Use core header helpers when a generated operation accepts custom headers.
Use Idempotency-Key for retry-safe mutating requests. Use If-Match and If-None-Match with single-resource endpoints that support ETags.

Errors

The core package defines SendmuxApiError. Use ErrorMapper::fromThrowable() when you need to normalise a generated exception into the Sendmux error shape. Use the mapped error code, retryability, status, and request ID when deciding whether to retry or contact support.

Next steps

SDK overview

Choose the right package family and API surface.

Versioning and support

Check compatibility, support, and upgrade guidance.

Management API

Review the Management API contract used by sendmux/management.

API keys

Create and scope the credentials used by SDK clients.