avido / postnl-cif-rest-api-php-client
A PHP Client for the Post NL Webservices
0.4.6
2019-11-20 14:29 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ^6.2
- monolog/monolog: ^1.23
Requires (Dev)
- apigen/apigen: ^4.1
- phpunit/phpunit: *
- squizlabs/php_codesniffer: 2.*
README
PostNL CIF Rest Webservices API Client for PHP
Open source PHP client for the [PostNL Rest CIF Webservices] (https://developer.postnl.nl/).
Installation
Get it with composer
Run the command:
composer require avido/postnl-cif-rest-api-php-client
client initialization:
require __DIR__ . '/vendor/autoload.php'; use Avido\PostNLCifClient\CifApi; $apikey = '--YOUR APIKEY --'; $client = new CifApi($apiKey);
Example: Retrieve nearest locations based on address information
use Avido\PostNLCifClient\Request\DeliveryOptions\Locations\NearestLocationsRequest; // get nearest locations based on address information $request = new NearestLocationsRequest(); $request->setCountryCode('NL') ->setPostalcode('2132WT') ->setCity('Hoofddorp') ->setStreet('Siriusdreef') ->setHouseNumber(42) ->setDeliveryDate('01-01-2999') ->setOpeningTime('09:00:00') ->addDeliveryOptions('PG'); // load api "getAPI" based on required services. $response = $client->getAPI('location')->getNearestLocations($request);
Unit tests
<phpunit> ... <php> <env name="PHP_APIKEY" value="--YOUR APIKEY--"/> </php> </phpunit>
Implementation Status
This library is still in development, new releases / implementations will follow.