{"id":20375278,"url":"https://github.com/cba85/php-mondialrelay-webservice","last_synced_at":"2025-04-12T07:17:56.118Z","repository":{"id":62500239,"uuid":"212373801","full_name":"cba85/php-mondialrelay-webservice","owner":"cba85","description":"PHP interface for Mondial Relay webservice","archived":false,"fork":false,"pushed_at":"2021-04-26T14:14:12.000Z","size":45,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T07:17:50.447Z","etag":null,"topics":["mondial-relay","mondialrelay-api","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cba85.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-02T15:16:50.000Z","updated_at":"2024-10-01T04:33:43.000Z","dependencies_parsed_at":"2022-11-02T12:01:00.355Z","dependency_job_id":null,"html_url":"https://github.com/cba85/php-mondialrelay-webservice","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-mondialrelay-webservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-mondialrelay-webservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-mondialrelay-webservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-mondialrelay-webservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cba85","download_url":"https://codeload.github.com/cba85/php-mondialrelay-webservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530604,"owners_count":21119601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mondial-relay","mondialrelay-api","php"],"created_at":"2024-11-15T01:29:36.788Z","updated_at":"2025-04-12T07:17:56.093Z","avatar_url":"https://github.com/cba85.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Mondialrelay Webservice\n\nAn expressive, fluent interface to Mondial Relay's shipping services.\n\n## Installation\n\nInstall using Composer :\n\n```\n$ composer require cba85/php-mondialrelay-webservice\n```\n\nNote: you must have PHP with Soap enabled.\n\n## Getting started\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n// 1. Initialize Mondial Relay webservice with your credentials.\n$mondialrelay = new Webservice('BDTEST13', 'PrivateK');\n\n// 2. Create parameters for the method you want to use.\n $parameters = [\n    'Pays' =\u003e 'FR',\n    'Ville' =\u003e 'Paris',\n    'NbResult' =\u003e 5\n];\n\n// 3. Call the method using your parameters and get the results in json format\n$searchPostcode = $mondialrelay-\u003esearchPostcode($parameters)-\u003egetResultsInJson();\n\n// {\"STAT\":\"0\",\"Liste\":{\"Commune\":[{\"CP\":\"75001\",\"Ville\":\"PARIS\",\"Pays\":\"FR\"},{\"CP\":\"75002\",\"Ville\":\"PARIS\",\"Pays\":\"FR\"},{\"CP\":\"75003\",\"Ville\":\"PARIS\",\"Pays\":\"FR\"},{\"CP\":\"75004\",\"Ville\":\"PARIS\",\"Pays\":\"FR\"},{\"CP\":\"75005\",\"Ville\":\"PARIS\",\"Pays\":\"FR\"}]}}\n```\n\n## Usage\n\n### Webservice\n\nYou must obtain Mondial Relay credentials to use the webservice.\n\nYou could use Mondial Relay test credentials to try the webservice:\n\n- Enseigne (merchant): `BDTEST13`\n- Private key: `PrivateK`\n\n### Available methods\n\n| Method name          | Webservice method name     |\n| :------------------- | :------------------------- |\n| `searchPostcode()`   | WSI2_RechercheCP           |\n| `searchPostcode()`   | WSI2_RechercheCP           |\n| `statLabel()`        | WSI2_STAT_Label            |\n| `searchParcelshop()` | WSI4_PointRelais_Recherche |\n| `createLabel()`      | WSI2_CreationEtiquette     |\n| `createShipping()`   | WSI2_CreationExpedition    |\n| `getLabels()`        | WSI3_GetEtiquettes         |\n| `trackParcel()`      | WSI2_TracingColisDetaille  |\n\n### Results\n\nYou can retrieve webservice results as a PHP StdClass Object or in Json format.\n\n```php\n$mondialrelay = new Webservice('BDTEST13', 'PrivateK');\n\n// E.g. Call a method\n$parameters = [...]; // Parameters of the method\n\n// PHP StdClass object results\n$searchParcelshop = $mondialrelay-\u003esearchParcelshop($parameters)-\u003egetResults();\n\n// Json results\n$searchParcelshop = $mondialrelay-\u003esearchParcelshop($parameters)-\u003egetResultsInJson();\n```\n\n#### Last method call\n\nYou could retrieve the results, parameters or call another request of the webservice using `method` attribute that contains the last method call:\n\n```php\n$mondialrelay = new Webservice('BDTEST13', 'PrivateK');\n\n// E.g. Call a method\n$parameters = [...]; // Parameters of the method\n\n$searchParcelshop = $mondialrelay-\u003esearchParcelshop($parameters)-\u003egetResults();\n\n$mondialrelay-\u003emethod-\u003eparameters; // Get last method called parameters\n$mondialrelay-\u003emethod-\u003eresults; // Get last method called results\n$mondialrelay-\u003emethod-\u003erequest()-\u003eresults(); // Create another request using last method and parameters called and get the results\n```\n\n### Parameters\n\nThe parameters you pass throught the method are automatically checked based on Mondial Relay regex patterns.\n\nPostal code parameters and phone numbers parameters are automatically checked depending the country parameter they depends on.\n\n#### Get setted parameters\n\nYou can check the setted parameters of the last method you called using:\n\n```php\n$mondialrelay = new Webservice('BDTEST13', 'PrivateK');\n\n// E.g. Call a method\n$parameters = [...]; // Parameters of the method\n$searchParcelshop = $mondialrelay-\u003esearchParcelshop($parameters)-\u003egetResults();\n\nprint_r($mondialrelay-\u003emethod-\u003eparameters);\n```\n\n#### Get error parameters\n\nIf at least one of your parameter doesn't match its regex patterns during the parameters checking, an exception will be thrown to prevent useless webservice call.\n\nYou could retrieve these errors:\n\n```php\n$mondialrelay = new Webservice('BDTEST13', 'PrivateK');\n\n// E.g. Call a method\n$parameters = ['Pays' =\u003e \"FRA\"]; // Parameters of the method with at least a bad parameter\n\n// Display parameters with error\ntry {\n    $searchParcelshop = $mondialrelay-\u003esearchParcelshop($parameters)-\u003egetResults();\n} catch (Exception $e) {\n    print_r($mondialrelay-\u003emethod-\u003eparameter-\u003egetErrors());\n}\n\n/*\nArray\n(\n    [Pays] =\u003e FRA\n)\n*/\n```\n\n## Documentation\n\n- [Mondial Relay Web Service v5.6](https://www.mondialrelay.fr/media/108937/Solution-Web-Service-V5.6.pdf)\n\n## Tests\n\n```\n$ ./vendor/bin/phpunit --bootstrap vendor/autoload.php\n```\n\nIf you want to test something specific, just add the filename you want to test.\n\nExample:\n\n```\n$ ./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/WebserviceTest.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcba85%2Fphp-mondialrelay-webservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcba85%2Fphp-mondialrelay-webservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcba85%2Fphp-mondialrelay-webservice/lists"}