Search by

community-sdks / mxroute-laravel

Laravel wrapper for the community-sdks/mxroute-php SDK

Maintainers

Package info

github.com/community-sdks/mxroute-laravel

pkg:composer/community-sdks/mxroute-laravel

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

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

This package is auto-updated.

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


README

Laravel integration for the strictly typed community-sdks/mxroute-php SDK.

Installation

composer require community-sdks/mxroute-laravel

The service provider and facade are discovered automatically. Publish the configuration if you want to customize it:

php artisan vendor:publish --tag=mxroute-config

Add your MXroute credentials to .env:

MXROUTE_API_KEY=your-api-key
MXROUTE_SERVER=your-server.mxrouting.net
MXROUTE_USERNAME=your-username

These optional settings are also available:

MXROUTE_BASE_URL=https://api.mxroute.com
MXROUTE_TIMEOUT=30
MXROUTE_USER_AGENT=my-application/1.0

Usage

Inject the upstream client into a controller, job, command, or service:

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

final class CreateMailbox
{
    public function __construct(private readonly MXRouteClient $mxroute) {}

    public function handle(): void
    {
        $this->mxroute->emailAccounts()->createEmailAccount(
            'example.com',
            new CreateEmailAccountRequest(
                username: 'hello',
                password: 'SecurePassword1',
                quota: 1024,
            ),
        );
    }
}

Or use the facade:

use CommunitySDKs\MXRouteLaravel\Facades\MXRoute;

$domains = MXRoute::domains()->listDomains();

All upstream services and DTOs remain available without an extra abstraction layer. See the upstream SDK documentation for its complete API.

Testing applications that use this package

Replace the client in Laravel's container with a test instance or an SDK client built with a custom TransportInterface:

$fake = new \CommunitySDKs\MXRoute\MXRouteClient($fakeTransport);
$this->app->instance(\CommunitySDKs\MXRoute\MXRouteClient::class, $fake);

License

The MIT License (MIT).