PHP code example of lsv / pd-parcelshop-api

1. Go to this page and download the library: Download lsv/pd-parcelshop-api 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/ */

    

lsv / pd-parcelshop-api example snippets



Lsv\PdDk\Client;

$p = new Client( API_KEY );
$shop = $p->getParcelshop( ZIPCODE , ID );
// Yes zipcode is unfortunately mandatory


Lsv\PdDk\Client;

$p = new Client( API_KEY );
$shops = $p->getParcelshopsFromZipcode( ZIPCODE );


Lsv\PdDk\Client;

$p = new Client( API_KEY );
$shops = $p->getParcelshopsNearAddress( STREET , ZIPCODE, 20 );


Lsv\PdDk\Client;
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;

$retry = new RetrySubscriber([
    'filter' => RetrySubscriber::createStatusFilter()
]);

$httpClient = new GuzzleHttp\Client();
$httpClient->getEmitter()->attach($retry);

$p = new Client($httpClient);
$shops = $p->getParcelshopsNearAddress( STREET , ZIPCODE, 20 );