dev-master
9999999-dev https://github.com/martijnpieters/pakketmailPakketMail SDK for API version 2.0
MIT
The Requires
- php >=7.0
- guzzlehttp/guzzle ^6.3
- ext-curl *
The Development Requires
by Martijn Pieters
api sdk pakketmail
Wallogit.com
2017 © Pedro Peláez
PakketMail SDK for API version 2.0
The easiest way to install the PakketMail SDK is to require it with Composer., (*1)
$ composer require martijnpieters/pakketmail:dev-master
Require the Composer autoloader and include the PakketMail namespace., (*2)
require 'vendor/autoload.php'; use MartijnPieters\PakketMail;
Initialize a request with your username and password, and optionally the development flag true., (*3)
$pakketMailRequest = new PakketMail\Request('username', 'password', true);
Create a new parcel and add it to the request., (*4)
$shipmentProperties = [
'pakketMailProduct' => PakketMail\Shipment::PAKKETMAIL_PRODUCT_DPD,
'clientReference' => 'A123',
'name1' => 'John Doe',
'streetName' => 'Main street',
'city' => 'Foo City',
'postalCode' => '1234 AB',
'country' => 'NLD',
];
$shipment = new PakketMail\Shipment($shipmentProperties);
$pakketMailRequest->addShipment($shipment);
Execute the request and retrieve the day close URL (dagafsluiting)., (*5)
$pakketMailRequest->sendToApi(); print($pakketMailRequest->getDayCloseUrl());
Catch exceptions during the API call., (*6)
try {
$pakketMailRequest->sendToApi();
} catch (PakketMail\Exception $e) {
throw new Exception($e->getMessage());
}
PakketMail SDK for API version 2.0
MIT
api sdk pakketmail