PHP code example of lsv / glsdk-parcelshop-api

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



Lsv\GlsDk\ParcelShop;

$p = new ParcelShop();
$shop = $p->getParcelshop( ID );


Lsv\GlsDk\ParcelShop;

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


Lsv\GlsDk\ParcelShop;

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


Lsv\GlsDk\ParcelShop;

$p = new ParcelShop();
$shops = $p->getAllParcelshops();


Lsv\GlsDk\ParcelShop;
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;

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

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

$p = new ParcelShop($client);
$shops = $p->getAllParcelshops();


Lsv\GlsDk\ParcelShop;

$p = new ParcelShop(null, 'url-to-webservice');
$shops = $p->getAllParcelshops();