qubrics / sending
Qubrics Sending API client for PHP.
Requires
- php: ^8.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.15.5
- guzzlehttp/psr7: ^2.13.1
- qubrics/core: ^3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-07 04:56:52 UTC
README
Qubrics Sending API client for PHP.
Read the PHP SDK guide at qubrics.com/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
Run this command only after
Packagist lists qubrics/sending version 3.0.0.
Until then, retain your existing Composer constraint.
composer require qubrics/sending:^3.0
Before upgrading from 2.x, read the PHP 3.0 migration guide for Composer package and PHP namespace changes. If you use 1.x, apply the PHP 2.0 migration guide first.
If your custom Guzzle client uses FileCookieJar or SessionCookieJar, back up its state and re-authenticate into a fresh jar when upgrading. Guzzle rejects old records without a boolean HostOnly; do not guess that value. Default Qubrics API clients do not enable cookies. See the upstream migration warning.
Usage
Create the API group client with a send-capable key.
<?php require __DIR__ . '/vendor/autoload.php'; use Qubrics\Sending\ClientFactory; $emails = ClientFactory::createEmailsApi( getenv('QUBRICS_MAILBOX_API_KEY') ?: getenv('SENDMUX_MAILBOX_API_KEY') ?: null ); $meta = ClientFactory::createMetaApi( getenv('QUBRICS_MAILBOX_API_KEY') ?: getenv('SENDMUX_MAILBOX_API_KEY') ?: null );
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('QUBRICS_ACCESS_TOKEN') ?: getenv('SENDMUX_ACCESS_TOKEN') ?: '' );
See OAuth setup and lifecycle.
For API-key authentication, omit apiKey to read QUBRICS_API_KEY.
Omit baseUrl to read QUBRICS_BASE_URL.
Nonempty Qubrics values take precedence over SENDMUX_API_KEY and
SENDMUX_BASE_URL. Explicit arguments take precedence over environment values.
Features
- Validates
smx_mbx_keys or owner-approved Sending-resourcesmx_agent_tokens before configuring the client. - Uses
https://smtp.qubrics.com/api/v1by default. - Adds retry and rate-limit backoff behaviour through
qubrics/core. - Maps generated API responses into the shared Qubrics envelope and error model.
- Includes generated models for single-send and batch-send requests and responses.
Related packages
| Package | Use it for |
|---|---|
qubrics/core |
Shared helpers for auth, headers, retries, pagination, and errors. |
qubrics/mailbox |
Mailbox API client. |
qubrics/management |
Management API client. |
qubrics/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: qubrics.com/docs/sdks/php
- Sending API reference: qubrics.com/docs/sending-api/introduction
- API keys guide: qubrics.com/docs/guides/api-keys
- Source repository: github.com/qubrics/qubrics-sdk
License
MIT. See LICENSE.