定制 lsv/glsdk-parcelshop-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lsv/glsdk-parcelshop-api

最新稳定版本:1.0.4

Composer 安装命令:

composer require lsv/glsdk-parcelshop-api

包简介

Webservice for GLS ParcelShop

README 文档

README

Build Status Coverage Status

Get parcelshops from either

  • A parcelshop number
  • A danish zipcode
  • Nearby an address
  • Or get all parcelshops in Denmark

Get single parcelshop by Id

<?php
require 'vendor/autoload.php';

use Lsv\GlsDk\ParcelShop;

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

Throws Exceptions\ParcelNotFoundException if not found

Returns $shop is a Entity\Parcelshop object

Get parcelshops from a zipcode

<?php
require 'vendor/autoload.php';

use Lsv\GlsDk\ParcelShop;

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

Throws Exceptions\NoParcelsFoundInZipcodeException if none found

Returns $shops is a array of Entity\Parcelshop

Get parcelshops near address

<?php
require 'vendor/autoload.php';

use Lsv\GlsDk\ParcelShop;

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

Third argument is how many you want

Throws Exceptions\MalformedAddressException if address is unknown

Returns $shops is a array of Entity\Parcelshop

Get all parcelshops in Denmark

<?php
require 'vendor/autoload.php';

use Lsv\GlsDk\ParcelShop;

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

Returns $shops is a array of Entity\Parcelshop

Add retry guzzle client

First install it with composer

composer require guzzlehttp/retry-subscriber

Now create our client

<?php
require 'vendor/autoload.php';

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

Change to another GLS country

<?php
require 'vendor/autoload.php';

use Lsv\GlsDk\ParcelShop;

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

统计信息

  • 总下载量: 1.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-27