sendmux / sending
Sendmux Sending API client for PHP.
Requires
- php: ^8.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.10
- guzzlehttp/psr7: ^2.7
- sendmux/core: ^2.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-11 03:29:15 UTC
README
Sendmux Sending API client for PHP.
Read the PHP SDK guide at sendmux.ai/docs/sdks/php.
Requirements
- PHP 8.2 or newer.
- Composer.
- A send-capable
smx_mbx_key or owner-approved Sending-resourcesmx_agent_token. Alternatively, use a REST OAuth access token with the required scopes.
Installation
composer require sendmux/sending:^2.1
Upgrading from 1.x? Read the PHP 2.0 migration guide before changing your Composer constraint.
Usage
Create the API group client with a send-capable key.
<?php require __DIR__ . '/vendor/autoload.php'; use Sendmux\Sending\ClientFactory; $emails = ClientFactory::createEmailsApi( getenv('SENDMUX_MAILBOX_API_KEY') ?: '' ); $meta = ClientFactory::createMetaApi( getenv('SENDMUX_MAILBOX_API_KEY') ?: '' );
The generated EmailsApi exposes sendingSendEmail() and sendingSendEmailBatch(). The generated MetaApi exposes sendingGetConnection() to test credentials without sending email, and sendingGetOpenApiSpec().
OAuth access tokens
ClientFactory::createMetaApiWithAccessToken($accessToken) accepts a bare token or a callable returning one. Every API group factory has the same WithAccessToken variant. Providers run on each request and retry; your application owns token storage and refresh coordination. OAuth clients do not follow redirects.
$client = ClientFactory::createMetaApiWithAccessToken( static fn (): string => getenv('SENDMUX_ACCESS_TOKEN') ?: '' );
See OAuth setup and lifecycle.
Features
- Validates
smx_mbx_keys or owner-approved Sending-resourcesmx_agent_tokens before configuring the client. - Uses
https://smtp.sendmux.ai/api/v1by default. - Adds retry and rate-limit backoff behaviour through
sendmux/core. - Maps generated API responses into the shared Sendmux envelope and error model.
- Includes generated models for single-send and batch-send requests and responses.
Related packages
| Package | Use it for |
|---|---|
sendmux/core |
Shared helpers for auth, headers, retries, pagination, and errors. |
sendmux/mailbox |
Mailbox API client. |
sendmux/management |
Management API client. |
sendmux/sdk |
Umbrella package that installs all PHP SDK surfaces. |
Support
For help, include the package name, version, API surface, and sanitised request details. Do not include API keys, tokens, passwords, webhook secrets, customer data, or private account details.
- PHP SDK guide: sendmux.ai/docs/sdks/php
- Sending API reference: sendmux.ai/docs/sending-api/introduction
- API keys guide: sendmux.ai/docs/guides/api-keys
- Source repository: github.com/Sendmux/sendmux-sdk
License
MIT. See LICENSE.