kerekit/gls-parcelshops-cee 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kerekit/gls-parcelshops-cee

Composer 安装命令:

composer require kerekit/gls-parcelshops-cee

包简介

Query GLS parcelshops in CEE countries

README 文档

README

This package can retrieve info about GLS (General Logistics Systems) parcelshops located in the CEE (Central and Eastern European) region, specifically:

  • CZ (Czech Republic)
  • HR (Croatia)
  • HU (Hungary)
  • RO (Romania)
  • SI (Slovenia)
  • SK (Slovakia)

While tehere is a [SOAP web service on GLS.dk][1] supporting multiple countries to query parcelshops from, it returns an empty list for the above ones. The [GLS Netherlands API][2] requires authentication and seems to publish only Dutch parcelshops.

This leaves us with studying [a local parcelshop search's JavaScript][3], which is aware of the region. The consumed web service is undocumented, so You may expect it to disappear or mutate any moment. Until there's an official API for the region, this is your best shot. This package tries to detect unexpected behavior and throws an exception in such cases.

Installation

composer require kerekit/gls-ee-parcelshops

Usage

use Kerekit\GlsParcelshopsCee\{Parcelshop,CountryCode};

/**
 * List parcelshops in Hungary.
 *
 * NOTE: "ctrcode" is required, but you can use more filters (see
 * \Kerekit\GlsParcelshopsCee\Request\GetList properties), but results seem to
 * be inconsequent.
 */
$parcelshops = Parcelshop::list (ctrcode: CountryCode::HU);

// Display some info about the first parcelshop.
$p = $parcelshops [0];
echo "The first shop's name is '$p->name'. You can call them on '$p->phone'.\n";

/**
 * Retrieve & display some opening hours for the first parcelshop.
 *
 * NOTE: Opening indexes range from 1 to 7 - Monday to Sunday!
 */
$openings = $p->getOpenings ();
$mon = $openings [1] ?? null;
if (!is_null ($mon)) {
    echo "Opening hours on Monday: $mon->open (lunch break: $mon->midbreak).\n";
}
$sun = $openings [7] ?? null;
if (!is_null ($sun)) {
    echo "Opening hours on Sunday: $sun->open (lunch break: $sun->midbreak).\n";
}

[1]: https://www.gls.dk/webservices_v4/wsShopFinder.asmx (GLS.dk web service)
[2]: https://api-portal.gls.nl/ (GLS Netherlands API)
[3]: https://online.gls-hungary.com/psmap/psmap.js (Hungarian search script)

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固