Search by

sendmux / sending

roshanjonah

Sendmux Sending API client for PHP.

v2.1.0 2026-09-11 03:27 UTC

This package is auto-updated.

Last update: 2026-09-11 03:29:15 UTC


README

Packagist version PHP version License

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-resource smx_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-resource smx_agent_ tokens before configuring the client.
  • Uses https://smtp.sendmux.ai/api/v1 by 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.

License

MIT. See LICENSE.