PHP code example of ecommercegeeks / myparcel-sdk
1. Go to this page and download the library: Download ecommercegeeks/myparcel-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/ */
ecommercegeeks / myparcel-sdk example snippets
// Creating a connector doesn't make a network request yet, so can be initialized safely at application init.
$connector = new Connector($apiKey);
// Fill the DTOs
$shipment = new Shipment(recipient: new Recipient(...), ...);
// Create the request
$shipmentRequest = new AddShipments([$shipment]);
// Send the request
$response = $connector->send($shipmentRequest);
// Convert the request to an array of Shipment ids
$ids = $response->dtoOrFail();