c24-toys/php-gls-shipping-sdk
Composer 安装命令:
composer require c24-toys/php-gls-shipping-sdk
包简介
SDK for GLS Web API for Parcel Processing
README 文档
README
The GLS Parcel Processing API SDK package offers an interface to the following web services:
- GLS Web API for Parcel Processing
- GLS Web API for Parcel Cancellation
Requirements
System Requirements
- PHP 7.2+ with JSON extension
Package Requirements
netresearch/jsonmapper: Mapper for deserialization of JSON response messages into PHP objectsphp-http/discovery: Discovery service for HTTP client and message factory implementationsphp-http/httplug: Pluggable HTTP client abstractionphp-http/logger-plugin: HTTP client logger plugin for HTTPlugpsr/http-client: PSR-18 HTTP client interfacespsr/http-factory: PSR-7 HTTP message factory interfacespsr/http-message: PSR-7 HTTP message interfacespsr/log: PSR-3 logger interfaces
Virtual Package Requirements
psr/http-client-implementation: Any package that provides a PSR-18 compatible HTTP clientpsr/http-factory-implementation: Any package that provides PSR-7 compatible HTTP message factoriespsr/http-message-implementation: Any package that provides PSR-7 HTTP messages
Development Package Requirements
nyholm/psr7: PSR-7 HTTP message factory & message implementationphpunit/phpunit: Testing frameworkphp-http/mock-client: HTTPlug mock client implementationphpstan/phpstan: Static analysis toolsquizlabs/php_codesniffer: Static analysis tool
Installation
$ composer require c24-toys/php-gls-shipping-sdk
Uninstallation
$ composer remove c24-toys/php-gls-shipping-sdk
Testing
$ composer test
Features
The GLS Parcel Processing API SDK supports the following features:
- Create shipments with labels
- Cancel parcels
Create Shipments
Create shipments with one or more parcels and retrieve shipping labels. Value-added services may be ordered per parcel. Return shipment labels can be requested either standalone ("return only") or together with the regular "way-to" label.
Public API
The library's components suitable for consumption comprise
- services:
- service factory
- shipment service
- data transfer object builders
- data transfer objects:
- shipment with parcels
- exceptions
Usage
$logger = new \Psr\Log\NullLogger(); $serviceFactory = new \C24Toys\GLS\Sdk\ParcelProcessing\Service\ServiceFactory(); $service = $serviceFactory->createShipmentService('basicAuthUser', 'basicAuthPass', $logger, $sandbox = true); // REGULAR SHIPMENT $requestBuilder = new \C24Toys\GLS\Sdk\ParcelProcessing\RequestBuilder\ShipmentRequestBuilder(); $requestBuilder->setShipperAccount($shipperId = '98765 43210'); $requestBuilder->setRecipientAddress( $country = 'DE', $postalCode = '36286', $city = 'Neuenstein', $street = 'GLS-Germany-Straße 1 - 7', $name = 'Jane Doe' ); $requestBuilder->addParcel($parcelWeightA = 0.95); $requestBuilder->addParcel($parcelWeightB = 1.2); $request = $requestBuilder->create(); $shipment = $service->createShipment($request); // work with the web service response, e.g. persist label foreach ($shipment->getLabels() as $i => $label) { file_put_contents("/tmp/{$shipment->getConsignmentId()}-{$i}.pdf", $label); } // RETURN SHIPMENT $requestBuilder = new \C24Toys\GLS\Sdk\ParcelProcessing\RequestBuilder\ReturnShipmentRequestBuilder(); $requestBuilder->setShipperAccount($shipperId = '98765 43210'); $requestBuilder->setShipperAddress( $country = 'DE', $postalCode = '36286', $city = 'Neuenstein', $street = 'GLS-Germany-Straße 1 - 7', $name = 'Jane Doe' ); $requestBuilder->setRecipientAddress( $country = 'DE', $postalCode = '36286', $city = 'Neuenstein', $street = 'GLS Germany-Straße 1 - 7', $company = 'GLS Germany' ); $requestBuilder->addParcel($weight = 0.95, $qrCode = true); $request = $requestBuilder->create(); $shipment = $service->createShipment($request);
Cancel Parcels
Cancel one or more parcels.
Public API
The library's components suitable for consumption comprise
- services:
- service factory
- cancellation service
- exceptions
Usage
$logger = new \Psr\Log\NullLogger(); $serviceFactory = new \C24Toys\GLS\Sdk\ParcelProcessing\Service\ServiceFactory(); $service = $serviceFactory->createCancellationService('basicAuthUser', 'basicAuthPass', $logger, $sandbox = true); $cancelledIds = $service->cancelParcels([$parcelIdA = '12345', $parcelIdB = '54321']);
Forked from https://github.com/netresearch/gls-sdk-api-parcel-processing
c24-toys/php-gls-shipping-sdk 适用场景与选型建议
c24-toys/php-gls-shipping-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.35k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「gls」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 c24-toys/php-gls-shipping-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 c24-toys/php-gls-shipping-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 c24-toys/php-gls-shipping-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle that integrates the GLS webservice PHP SDK
Web-IT GLS Tracking API
Courier
GLS Api Client
GLS ADE and GLS Track & Trace API Symfony 2 integration
Allows you to send your order data to RoutiGo to set up route plans.
统计信息
- 总下载量: 13.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-24