PHP code example of shipmondo / shipmondo_php_sdk

1. Go to this page and download the library: Download shipmondo/shipmondo_php_sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shipmondo / shipmondo_php_sdk example snippets

5

  try {
    $client = new Shipmondo('api_user', 'api_key');
  } catch (ShipmondoException $e) {
    echo $e->getMessage();
  }
5

  echo $client->getAccountBalance();
5

  $params = [
    'created_at_min' => '2019-08-22',
    'page' => 1
  ];
  echo $client->getAccountPaymentRequests($params);
5

  $params = [
    'country_code' => 'DK',
    'carrier_code' => 'gls',
    'page' => 1
  ];
  echo $client->getProducts($params);
5

  $params = [
    'country_code' => 'DK',
    'carrier_code' => 'gls',
    'zipcode' => '5000'
  ];
  echo $client->getPickupPoints($params);
5

  $params = [
    'page' => 1,
    'carrier_code' => 'dao'
  ];
  echo $client->getShipments($params);
5

  $id = 5545625;
  echo $client->getShipment($id);  
5

  $shipment_id = 5545625;
  $params = [
    'label_format' => '10x19_pdf'
  ];
  echo $client->getShipmentLabels($shipment_id, $params);  
5

  $params = [
    "test_mode" => true,
    "own_agreement" => true,
    "label_format" => "a4_pdf",
    "product_code" => "GLSDK_HD",
    "service_codes" => "EMAIL_NT,SMS_NT",
    "order_id" => "10001",
    "reference" => "Webshop 10001",
    "sender" => [
      "name" => "Shipmondo ApS",
      "address1" => "Strandvejen 6B",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5240",
      "city" => "Odense NØ",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "70400407",
      "mobile" => "70400407"       
    ],
    "receiver" => [
      "name" => "Lene Jensen",
      "address1" => "Vindegade 112",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5000",
      "city" => "Odense C",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "50607080",
      "mobile" => "50607080",
      "instruction" => null
    ],
    "parcels" => [
      [
        "weight" => 1000
      ]
    ],
  ];
  echo $client->createShipment($params);
5

  $params = [
    'page' => 1
  ];
  echo print_r($client->getPrintQueueEntries($params);
5

  $params = [
    'page' => 1
  ];
  echo $client->getReturnPortals($params);  
5

  $id = 4766;
  echo $client->getReturnPortal($id);  
5

  $return_portal_id = 4766;
  $params = [
    'page' => 1
  ];
  echo $client->getReturnPortalShipments($return_portal_id, $params);  
5

  $params = [
    'page' => 1
  ];
  echo $client->getImportedShipments($params);
5

  $id = 75545625;
  echo $client->getImportedShipment($id);
5

  $params = [
    "carrier_code" => "gls",
    "product_code" => "GLSDK_HD",
    "service_codes" => "EMAIL_NT,SMS_NT",
    "order_id" => "10001",
    "reference" => "Webshop 10001",
    "sender" => [
      "name" => "Shipmondo ApS",
      "address1" => "Strandvejen 6B",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5240",
      "city" => "Odense NØ",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "70400407",
      "mobile" => "70400407"       
    ],
    "receiver" => [
      "name" => "Lene Jensen",
      "address1" => "Vindegade 112",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5000",
      "city" => "Odense C",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "50607080",
      "mobile" => "50607080",
      "instruction" => null
    ]
  ];
  echo $client->createImportedShipment($params);
5

  $id = 75545625;
  $params = [
    "carrier_code" => "gls",
    "product_code" => "GLSDK_HD",
    "service_codes" => "EMAIL_NT,SMS_NT",
    "order_id" => "10001",
    "reference" => "Webshop 10001",
    "sender" => [
      "name" => "Shipmondo ApS",
      "address1" => "Strandvejen 6B",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5240",
      "city" => "Odense NØ",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "70400407",
      "mobile" => "70400407"       
    ],
    "receiver" => [
      "name" => "Lene Jensen",
      "address1" => "Vindegade 112",
      "address2" => null,
      "country_code" => "DK",
      "zipcode" => "5000",
      "city" => "Odense C",
      "attention" => null,
      "email" => "[email protected]",
      "telephone" => "50607080",
      "mobile" => "50607080",
      "instruction" => null
    ]
  ];
  echo $client->updateImportedShipment($id, $params);
5

  $id = 75545625;
  echo $client->deleteImportedShipment($id);