Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mondial Relay Bundle Laravel Package

ernadoo/mondial-relay-bundle

Symfony bundle for the ernadoo/mondial-relay PHP SDK. Autowires MondialRelayClientInterface, adds Symfony Profiler logging for calls and durations, and provides a Twig helper for the relay-point selection widget. Requires PHP 8.2+ and Symfony 6.4 or 7.x.

View on GitHub
Deep Wiki
Context7

ernadoo/mondial-relay-bundle

Symfony bundle for the ernadoo/mondial-relay PHP SDK.

  • Autowiring of MondialRelayClientInterface
  • Symfony Profiler integration (call log, duration)
  • Twig helper for the relay point selection widget

Requirements

  • PHP 8.2+
  • Symfony 6.4 or 7.x

Installation

composer require ernadoo/mondial-relay-bundle

If Symfony Flex is enabled the bundle registers automatically. Otherwise add it to config/bundles.php:

return [
    // ...
    Ernadoo\MondialRelayBundle\ErnadooMondialRelayBundle::class => ['all' => true],
];

Configuration

Create config/packages/ernadoo_mondial_relay.yaml:

ernadoo_mondial_relay:
    credentials:
        login:       '%env(MR_LOGIN)%'
        password:    '%env(MR_PASSWORD)%'
        customer_id: '%env(MR_CUSTOMER_ID)%'
        secret_key:  '%env(MR_SECRET_KEY)%'
    sandbox: false   # set to true (or '%kernel.debug%') for the MR sandbox

Add the environment variables to your .env:

MR_LOGIN=your-login
MR_PASSWORD=your-password
MR_CUSTOMER_ID=BDTEST
MR_SECRET_KEY=your-secret-key

Usage

Inject MondialRelayClientInterface anywhere in your Symfony application:

use Ernadoo\MondialRelay\Contract\MondialRelayClientInterface;
use Ernadoo\MondialRelay\Shipment\Address;
use Ernadoo\MondialRelay\Shipment\Parcel;
use Ernadoo\MondialRelay\Shipment\ShipmentRequest;

class LabelController extends AbstractController
{
    public function __construct(
        private readonly MondialRelayClientInterface $mondialRelay,
    ) {}

    public function print(): Response
    {
        $response = $this->mondialRelay->createShipment(new ShipmentRequest(
            sender:    new Address('FR', '59510', 'Hem', '4 Av. Pinay', 'Erwan', 'Nader'),
            recipient: new Address('FR', '75001', 'Paris', '1 Rue de la Paix', 'Jane', 'Doe'),
            parcels:   [new Parcel(500)],
        ));

        return $this->redirect($response->labelOutput); // download PDF
    }
}

Twig widget

{# Renders the Mondial Relay relay-point selection widget #}
{{ mondial_relay_widget('FR', '75001') }}

{# Just the customer ID, for your own JS integration #}
{{ mondial_relay_customer_id() }}

Documentation

Tests

composer install
vendor/bin/phpunit
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk