PHPackages                             smart-dato/mondial-relay-shipping-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. smart-dato/mondial-relay-shipping-sdk

ActiveLibrary

smart-dato/mondial-relay-shipping-sdk
=====================================

Laravel SDK for the Mondial Relay Dual Carrier API V2 (shipments &amp; labels)

0.0.2(today)012↑2900%MITPHPPHP ^8.4CI passing

Since Jul 23Pushed todayCompare

[ Source](https://github.com/smart-dato/mondial-relay-shipping-sdk)[ Packagist](https://packagist.org/packages/smart-dato/mondial-relay-shipping-sdk)[ Docs](https://github.com/smart-dato/mondial-relay-shipping-sdk)[ GitHub Sponsors](https://github.com/SmartDato)[ RSS](/packages/smart-dato-mondial-relay-shipping-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (14)Versions (3)Used By (0)

Mondial Relay Dual Carrier API V2 SDK for Laravel
=================================================

[](#mondial-relay-dual-carrier-api-v2-sdk-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fb16f8476d5a654ec7edd913bfd34ceff8230a49d4bdfdc660996d776c3498b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d6172742d6461746f2f6d6f6e6469616c2d72656c61792d7368697070696e672d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/mondial-relay-shipping-sdk)[![GitHub Tests Action Status](https://github.com/smart-dato/mondial-relay-shipping-sdk/actions/workflows/run-tests.yml/badge.svg)](https://github.com/smart-dato/mondial-relay-shipping-sdk/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://github.com/smart-dato/mondial-relay-shipping-sdk/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/smart-dato/mondial-relay-shipping-sdk/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/91cb08457b4e100cd4a4a9f8f9d017a0eccb04d6a5e45957941853c7a721ca9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d6172742d6461746f2f6d6f6e6469616c2d72656c61792d7368697070696e672d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/mondial-relay-shipping-sdk)

Create Mondial Relay / InPost shipments and print labels from Laravel using the [Dual Carrier API V2](https://www.mondialrelay.fr/media/124596/web-service-dual-carrier-v-271.pdf). Labels can be retrieved as a PDF URL, raw ZPL/IPL printer code, or QR code.

Installation
------------

[](#installation)

```
composer require smart-dato/mondial-relay-shipping-sdk
```

Optionally publish the config file:

```
php artisan vendor:publish --tag="mondial-relay-shipping-sdk-config"
```

Set your credentials in `.env`:

```
MONDIAL_RELAY_SHIPPING_SANDBOX=true
MONDIAL_RELAY_SHIPPING_LOGIN=M1ITTEST@business-api.mondialrelay.com
MONDIAL_RELAY_SHIPPING_PASSWORD=your-password
MONDIAL_RELAY_SHIPPING_CUSTOMER_ID=M1ITTEST
MONDIAL_RELAY_SHIPPING_CULTURE=fr-FR
MONDIAL_RELAY_SHIPPING_OUTPUT_TYPE=PdfUrl
MONDIAL_RELAY_SHIPPING_OUTPUT_FORMAT=10x15
```

While `MONDIAL_RELAY_SHIPPING_SANDBOX` is `true`, requests go to `connect-api-sandbox.mondialrelay.com`.

Usage
-----

[](#usage)

```
use SmartDato\MondialRelayShipping\Data\Address;
use SmartDato\MondialRelayShipping\Data\Parcel;
use SmartDato\MondialRelayShipping\Data\Shipment;
use SmartDato\MondialRelayShipping\Enums\CollectionMode;
use SmartDato\MondialRelayShipping\Enums\DeliveryMode;
use SmartDato\MondialRelayShipping\Facades\MondialRelayShipping;

$shipment = new Shipment(
    deliveryMode: DeliveryMode::PointRelais,
    deliveryLocation: 'FR-66974',
    collectionMode: CollectionMode::MerchantCollection,
    sender: new Address(
        streetname: 'Avenue Antoine Pinay',
        houseNo: '4',
        countryCode: 'FR',
        postCode: '59510',
        city: 'Hem',
        addressAdd1: 'My Shop',
    ),
    recipient: new Address(
        streetname: 'Test Street',
        houseNo: '10',
        countryCode: 'FR',
        postCode: '75001',
        city: 'Paris',
        firstname: 'John',
        lastname: 'Doe',
        phoneNo: '+33320202020',
    ),
    parcels: [new Parcel(weightGrams: 1000, content: 'Books')],
    orderNo: 'ORDER-1234',
);

$created = MondialRelayShipping::createShipment($shipment);

$created->shipmentNumber;        // "96408887"
$created->labels[0]->output;     // PDF URL (or base64 printer code)
$created->labels[0]->decoded();  // raw ZPL/IPL when using printer output
$created->warnings();            // non-blocking API warnings
```

### Delivery and collection modes

[](#delivery-and-collection-modes)

Enum caseCodeMeaning`DeliveryMode::PointRelais`24RPoint Relais® delivery (requires `deliveryLocation`)`DeliveryMode::PointRelaisXL`24LPoint Relais® XL delivery (multi-parcel capable)`DeliveryMode::HomeDelivery`HOMHome delivery (requires recipient phone)`DeliveryMode::HomeDeliveryNextDay`XOHD+1 home delivery (requires EDI setup)`DeliveryMode::MerchantDelivery`LCCDelivery back to the merchant (returns)`CollectionMode::MerchantCollection`CCCCollected at the merchant (outbound)`CollectionMode::PointRelaisCollection`RELDropped off at a Point Relais® (returns)### Label output

[](#label-output)

```
use SmartDato\MondialRelayShipping\Data\OutputOptions;
use SmartDato\MondialRelayShipping\Enums\OutputFormat;
use SmartDato\MondialRelayShipping\Enums\OutputType;

$created = MondialRelayShipping::createShipment(
    $shipment,
    new OutputOptions(OutputType::ZplCode, OutputFormat::ZplGeneric10x15),
);

$zpl = $created->labels[0]->decoded();
```

### Batches

[](#batches)

`createShipments()` accepts multiple shipments and never throws for individual failures:

```
$result = MondialRelayShipping::createShipments([$first, $second]);

$result->successful(); // CreatedShipment[]
$result->failed();     // CreatedShipment[] with their error statuses
$result->errors();     // Status[] (code, level, message)
```

### Multiple accounts

[](#multiple-accounts)

The facade uses the credentials from the config file. To ship on behalf of other accounts, instantiate clients directly — every setting is a constructor argument:

```
use SmartDato\MondialRelayShipping\MondialRelayShipping;

$otherAccount = new MondialRelayShipping(
    login: 'OTHER@business-api.mondialrelay.com',
    password: 'other-password',
    customerId: 'OTHER123',
    culture: 'de-DE',
    sandbox: false,
);

$otherAccount->createShipment($shipment);
```

### Raw request &amp; response

[](#raw-request--response)

Every live call carries the raw HTTP exchange — on results and on all exceptions thrown after the request was built:

```
$result = MondialRelayShipping::createShipments([$shipment]);

$result->exchange->request;            // XML sent (contains credentials!)
$result->exchange->sanitizedRequest(); // XML with the password masked — safe to log
$result->exchange->response;           // raw XML received
$result->exchange->status;             // HTTP status code

try {
    MondialRelayShipping::createShipment($shipment);
} catch (RequestFailedException|CriticalErrorException|ShipmentFailedException|InvalidResponseException $exception) {
    logger()->error('Mondial Relay call failed', [
        'request' => $exception->exchange?->sanitizedRequest(),
        'response' => $exception->exchange?->response,
    ]);
}
```

On a connection failure `response` and `status` are `null` but the request XML is still available. The exchange is excluded from `toArray()`/`toJson()` so serialized results never leak credentials.

### Error handling

[](#error-handling)

All exceptions extend `SmartDato\MondialRelayShipping\Exceptions\MondialRelayShippingException`:

- `InvalidShipmentException` — the shipment breaks a documented constraint before any HTTP call (missing relay location, parcel under 10 g, multi-parcel on a single-parcel mode, …)
- `InvalidConfigurationException` — missing/malformed credentials, customer id, or culture; thrown on the first API call, not when the client is resolved, so tooling that instantiates all container bindings (`ide-helper:generate`, `artisan about`) works without credentials
- `RequestFailedException` — connection failure or non-2xx HTTP response
- `InvalidResponseException` — the API returned unparseable XML
- `CriticalErrorException` — the API rejected the whole request (e.g. authentication); inspect `$exception->statuses`
- `ShipmentFailedException` — `createShipment()` could not create the shipment; inspect `$exception->statuses`

API warnings never throw — read them via `$created->warnings()` or `$result->warnings()`.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [SmartDato](https://github.com/smart-dato)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3006db55caec62526937fa2d941da32fc5e69e2ca86a52e87c8046da5958d82?d=identicon)[smart-dato](/maintainers/smart-dato)

---

Top Contributors

[![michael-tscholl](https://avatars.githubusercontent.com/u/178569346?v=4)](https://github.com/michael-tscholl "michael-tscholl (5 commits)")

---

Tags

laravelshippingSmartDatomondial-relaymondial-relay-shipping-sdk

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/smart-dato-mondial-relay-shipping-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/smart-dato-mondial-relay-shipping-sdk/health.svg)](https://phpackages.com/packages/smart-dato-mondial-relay-shipping-sdk)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M48](/packages/spatie-laravel-pdf)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

8120.4k](/packages/danestves-laravel-polar)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
