Download the PHP package ernadoo/mondial-relay-bundle without Composer

On this page you can find all versions of the php package ernadoo/mondial-relay-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mondial-relay-bundle

ernadoo/mondial-relay-bundle

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

Requirements

Installation

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

Configuration

Create config/packages/ernadoo_mondial_relay.yaml:

The credentials are named after MR Connect, Mondial Relay's customer area. Each one is only needed by the features that use it:

Environment variable In MR Connect Needed for
MONDIAL_RELAY_BRAND_CODE Code enseigne (brand code, 8 characters) Everything (always required)
MONDIAL_RELAY_API_LOGIN Login of an API user: Administration → User management → API configuration Creating labels
MONDIAL_RELAY_API_PASSWORD Password of that API user Creating labels
MONDIAL_RELAY_PRIVATE_KEY Clé privée (private key) of the brand Searching relay points through the API, and the api picker

A missing credential only fails the feature that needs it, with a clear message and a log entry. Add them to your .env.local (never commit them):

Upgrading from 3.2 or older: the former options customer_id, login, password and secret_key still work but are deprecated: rename them brand_code, api_login, api_password and private_key. The Twig function mondial_relay_customer_id() becomes mondial_relay_brand_code().

Sandbox

sandbox: true sends label creation to https://connect-api-sandbox.mondialrelay.com/api/shipment: labels are generated ("SANDBOX MODE") but nothing is recorded. It needs a valid API user. Relay point search always uses the production endpoint. Enable it outside production, for example:

Usage

Inject MondialRelayClientInterface anywhere in your application.

Creating a label

Handling errors

Every failure throws a MondialRelayException: ApiException when Mondial Relay rejects the request (with its codes, getErrors()), TransportException when it cannot be reached or answers with an unusable response, ConfigurationException when a credential is missing. Their messages are in English, for developers and logs.

To tell your users what went wrong, MondialRelayErrorMessage turns the exception into a translatable message (TranslatableInterface), in the ErnadooMondialRelayBundle domain:

Message key When
error.phone_number Invalid phone number (international format expected)
error.relay_point The relay point cannot receive the parcel (unknown, or unavailable for the delivery mode)
error.parcel_weight Parcel weight out of range for the delivery mode
error.post_code, error.country Postal code, city or country not recognised (relay point search)
error.configuration Missing or invalid credentials
error.unavailable Mondial Relay unreachable or unusable response: try again later
error.rejected Any other rejection

English and French are provided. The list of Mondial Relay codes is partial (Mondial Relay does not publish it): unknown codes fall back to error.rejected. Override or add languages as usual, with a translations/ErnadooMondialRelayBundle.<locale>.xlf file in your application.

Searching relay points

Symfony Profiler

In debug mode, every call to createShipment() and searchParcelShops() appears in the Mondial Relay panel of the Symfony Profiler: method, parameters, result, duration and error, if any. Label creation also shows up in the HTTP Client panel.

With symfony/stopwatch installed, calls also appear in the Performance timeline (category mondial_relay), next to your controllers and database queries.

Nothing is recorded by the Profiler outside debug mode.

Logs

In every environment, the client logs on the mondial_relay channel (Monolog, or any PSR-3 logger registered as logger):

Level Logged
info Shipment created (number, delivery mode, relay point), relay point search (result count)
warning Non-blocking warnings returned by Mondial Relay (code and message)
error Rejections with the Mondial Relay codes and messages, HTTP failures

Credentials, request and response bodies, and addresses are never logged. To send these logs to a dedicated file with Monolog:

Relay point picker

The picker is optional: label creation and relay point search work without it. Two modes:

widget (default) api
What it is The official Mondial Relay widget A list and a Leaflet map, rendered by the bundle
Credentials Brand code only Brand code and private key (the key stays on the server)
Loaded from Mondial Relay jQuery (if missing), Leaflet and their widget script Nothing: Leaflet and OpenStreetMap tiles only
Look and feel Mondial Relay's Yours (CSS custom properties)
Needs — The bundle routes; optionally symfony/rate-limiter and symfony/translation

Both modes need:

With AssetMapper, the controllers are registered automatically. With Webpack Encore, run npm install --force then rebuild your assets.

To use the api mode, import the routes of its search endpoint and choose it:

Options, highlighting a saved relay point, filling your own form fields, theming and the select event are described in the relay point picker documentation.

Tests


All versions of mondial-relay-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ernadoo/mondial-relay Version ^4.1
nyholm/psr7 Version ^1.8.2
symfony/framework-bundle Version ^6.4 || ^7.0 || ^8.0
symfony/http-client Version ^6.4 || ^7.0 || ^8.0
symfony/translation-contracts Version ^2.5 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ernadoo/mondial-relay-bundle contains the following files

Loading the files please wait ...