2017 © Pedro Peláez
 

library postnl-api-php

PostNL REST API PHP Bindings

image

shipcore-nl/postnl-api-php

PostNL REST API PHP Bindings

  • Tuesday, October 17, 2017
  • by niccifor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PostNL REST/SOAP API PHP Bindings

About

This PHP library for both PostNL's REST and SOAP API aims to provide a simple way to connect your application with PostNL. By abstracting away needless complexity when processing shipment information and increased fault-tolerance, you can get up and running with PostNL in minutes.
At the lower level this library uses asynchronous communication and payload splitting for improved performance., (*1)

Important notice

The PHP bindings can connect to both PostNL's SOAP and REST API.
The library is still a work-in-progress, but the Barcode, Labelling and Confirming will hopefully be completed soon., (*2)

Status

Service Status REST Status SOAP Version
Addresses
Adrescheck Nationaal N/A N/A N/A
Adrescheck Basis Nationaal N/A N/A N/A
Adrescheck Internationaal N/A N/A N/A
Persoon op AdresCheck Basis N/A N/A N/A
Geo Adrescheck Nationaal N/A N/A N/A
Creditworthiness & Business information
Bedrijfscheck Nationaal N/A N/A N/A
IBANcheck Nationaal N/A N/A N/A
Kredietcheck Consument Basis N/A N/A N/A
Kredietcheck Consument Premium N/A N/A N/A
Fraudepreventie Check Basis N/A N/A N/A
Kredietcheck Zakelijk N/A N/A N/A
Send & Track
Barcode webservice alpha alpha 1.1
Labelling webservice alpha alpha 2.1
Confirming webservice alpha alpha 1.10
Shippingstatus webservice Expected: September, 2017 Expected: September, 2017 1.6
Delivery Options
Deliverydate webservice Expected: September, 2017 Expected: September, 2017 2.2
Location webservice Expected: September, 2017 Expected: September, 2017 2.1
Timeframe webservice Expected: September, 2017 Expected: September, 2017 2.1
Mail
Bulkmail webservice N/A N/A N/A

Instructions

  • Clone this repo
  • Optionally run composer require guzzlehttp/guzzle to use Guzzle instead of cURL directly
  • Run composer install (Don't have composer? Visit https://getcomposer.org/)
  • You're good to go! A few small examples can be found in this README.

Example

Creating a label using default REST API, (*3)

<?php

use ThirtyBees\PostNL\PostNL;
use ThirtyBees\PostNL\Entity\Customer;
use ThirtyBees\PostNL\Entity\Address;
use ThirtyBees\PostNL\Entity\Shipment;
use ThirtyBees\PostNL\Entity\Dimension;

require_once __DIR__.'/vendor/autoload.php';

$customer = Customer::create([
    'CollectionLocation' => '123456',
    'CustomerCode' => 'DEVC',
    'CustomerNumber' => '11223344',
    'ContactPerson' => 'Lesley',
    'Address' => Address::create([
        'AddressType' => '02',
        'City'        => 'Hoofddorp',
        'CompanyName' => 'PostNL',
        'Countrycode' => 'NL',
        'HouseNr'     => '42',
        'Street'      => 'Siriusdreef',
        'Zipcode'     => '2132WT',
    ]),
    'Email' => 'michael@thirtybees.com',
    'Name' => 'Michael',
]);

$apikey = 'YOUR_API_KEY_HERE';
$sandbox = true;

$postnl = new PostNL($customer, $apikey, $sandbox);

$barcode = $postnl->generateBarcodeByCountryCode('NL');

$shipment = Shipment::create([
    'Addresses' => [
        Address::create([
            'AddressType' => '01',
            'City'        => 'Utrecht',
            'Countrycode' => 'NL',
            'FirstName'   => 'Peter',
            'HouseNr'     => '9',
            'HouseNrExt'  => 'a bis',
            'Name'        => 'de Ruijter',
            'Street'      => 'Bilderdijkstraat',
            'Zipcode'     => '3521VA',
        ]),
    ],
    'Barcode' => $barcode,
    'Dimension' => new Dimension('2000'),
    'ProductCodeDelivery' => '3085',
]);

$label = $postnl->generateLabel($shipment, 'GraphicFile|PDF', true);

var_dump($label);die();

The Versions

17/10 2017

dev-master

9999999-dev

PostNL REST API PHP Bindings

  Sources   Download

MIT

The Requires

 

by Michael Dekker
by Avatar niccifor

17/10 2017

dev-fix-undefined-property

dev-fix-undefined-property

PostNL REST API PHP Bindings

  Sources   Download

MIT

The Requires

 

by Michael Dekker

18/09 2017

0.1.0-alpha1

0.1.0.0-alpha1

PostNL REST API PHP Bindings

  Sources   Download

MIT

The Requires

 

by Michael Dekker