Search by

community-sdks / mxroute-php

A strictly typed PHP SDK for the MXroute REST API

Maintainers

Package info

github.com/community-sdks/mxroute-php

pkg:composer/community-sdks/mxroute-php

Transparency log

Statistics

Installs: 4

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-09-04 16:34 UTC

This package is auto-updated.

Last update: 2026-09-04 16:40:18 UTC


README

A small, strictly typed PHP 8.2+ client generated from the bundled MXroute OpenAPI 3.0 specification. It uses immutable request/response DTOs, final service classes, PSR-18 HTTP clients, PSR-17 factories, and domain-specific exceptions.

Installation

composer require community-sdks/mxroute-php

Guzzle is included and configured internally, so no separate HTTP client setup is required.

Quick start

use CommunitySDKs\MXRoute\Configuration;
use CommunitySDKs\MXRoute\DTOs\Requests\EmailAccounts\CreateEmailAccountRequest;
use CommunitySDKs\MXRoute\MXRouteClient;

$mxroute = new MXRouteClient(
    new Configuration(
        apiKey: getenv('MXROUTE_API_KEY'),
        server: getenv('MXROUTE_SERVER'),
        username: getenv('MXROUTE_USERNAME'),
    ),
);

$response = $mxroute->emailAccounts()->createEmailAccount(
    'example.com',
    new CreateEmailAccountRequest(
        username: 'hello',
        password: 'SecurePassword1',
        quota: 1024,
    ),
);

The API URL, request timeout, and user agent are configurable through Configuration. Advanced integrations can still use MXRouteClient::create() with custom PSR-18 and PSR-17 implementations, or inject a TransportInterface directly.

Services

See the documentation index for all 43 operations, grouped into 11 services.

Error handling

Non-2xx API responses throw ApiException, exposing the HTTP status, API error code, message, and decoded response body. Network failures throw TransportException. Both extend MXRouteException.

Development

composer install
composer test
composer generate

composer generate rebuilds endpoint services and DTOs from api-1.json.