Search by

qubrics / management

roshanjonah

Qubrics Management API client for PHP.

v3.0.0 2026-11-06 00:41 UTC

README

Packagist version PHP version License

Qubrics Management API client for PHP.

Read the PHP SDK guide at qubrics.com/docs/sdks/php.

Requirements

  • PHP 8.2 or newer.
  • Composer.
  • A team-scoped API key with the smx_root_ prefix. Alternatively, use a REST OAuth access token with the required scopes.

Installation

Run this command only after Packagist lists qubrics/management version 3.0.0. Until then, retain your existing Composer constraint.

composer require qubrics/management:^3.0

Before upgrading from 2.x, read the PHP 3.0 migration guide for Composer package and PHP namespace changes, provider-list response types, webhook fixtures, and removed model aliases. 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 generated API group you need with a team-scoped key.

<?php

require __DIR__ . '/vendor/autoload.php';

use Qubrics\Management\ClientFactory;

$connection = ClientFactory::createConnectionApi(
    getenv('QUBRICS_ROOT_API_KEY') ?: getenv('SENDMUX_ROOT_API_KEY') ?: null
);

$mailboxes = ClientFactory::createMailboxesApi(
    getenv('QUBRICS_ROOT_API_KEY') ?: getenv('SENDMUX_ROOT_API_KEY') ?: null
);

$domains = ClientFactory::createDomainsApi(
    getenv('QUBRICS_ROOT_API_KEY') ?: getenv('SENDMUX_ROOT_API_KEY') ?: null
);

$webhooks = ClientFactory::createWebhooksApi(
    getenv('QUBRICS_ROOT_API_KEY') ?: getenv('SENDMUX_ROOT_API_KEY') ?: null
);

Use $connection->managementGetConnection() to test credentials and retrieve team and credential details.

The factory also exposes clients for billing, domain filters, emails, inboxes, mailbox filters, sending accounts, and webhooks.

OAuth access tokens

ClientFactory::createConnectionApiWithAccessToken($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::createConnectionApiWithAccessToken(
    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_root_ API keys before configuring the client.
  • Uses https://app.qubrics.com/api/v1 by default.
  • Adds retry and rate-limit backoff behaviour through qubrics/core.
  • Covers domains, sending accounts, mailboxes, filters, webhooks, logs, metrics, and billing data.
  • Includes generated models for Management API requests and responses.

Related packages

Package Use it for
qubrics/core Shared helpers for auth, headers, retries, pagination, and errors.
qubrics/sending Sending API client.
qubrics/mailbox Mailbox 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.

License

MIT. See LICENSE.