2017 © Pedro Peláez
 

library pakketmail

PakketMail SDK for API version 2.0

image

martijnpieters/pakketmail

PakketMail SDK for API version 2.0

  • Sunday, November 19, 2017
  • by martijnpieters
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PakketMail SDK (PHP 7.0+)

Requirements

  • PakketMail account
  • PHP >= 7.0
  • PHP cURL extension

Installation

The easiest way to install the PakketMail SDK is to require it with Composer., (*1)

$ composer require martijnpieters/pakketmail:dev-master

Getting started

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());

Exceptions

Catch exceptions during the API call., (*6)

try {
    $pakketMailRequest->sendToApi();
} catch (PakketMail\Exception $e) {
    throw new Exception($e->getMessage());
}

The Versions

19/11 2017

dev-master

9999999-dev https://github.com/martijnpieters/pakketmail

PakketMail SDK for API version 2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martijn Pieters

api sdk pakketmail