dhl sdk api unified location finder
3.2.0
DPDHL統一位置查找器API SDK軟件包提供以下Web服務的接口:
netresearch/jsonmapper :用於將JSON響應消息的映射到PHP對象php-http/discovery :HTTP客戶端的發現服務和消息工廠實現php-http/httplug :可插拔的HTTP客戶抽象php-http/logger-plugin :httplug的http客戶端logger插件psr/http-client :PSR-18 HTTP客戶端接口psr/http-factory factory :PSR-7 HTTP消息工廠接口psr/http-message :PSR-7 HTTP消息接口psr/log :PSR-3記錄器接口psr/http-client-implementation :提供PSR-18兼容HTTP客戶端的任何軟件包psr/http-factory-implementation :提供PSR-7兼容HTTP消息的任何軟件包psr/http-message-implementation :提供PSR-7 HTTP消息的任何軟件包nyholm/psr7 :PSR-7 HTTP消息工廠和消息實現phpunit/phpunit :測試框架php-http/mock-client :httplug模擬客戶端實現phpstan/phpstan :靜態分析工具squizlabs/php_codesniffer :靜態分析工具rector/rector :自動重構工具可幫助PHP升級fig/log-test : psr/log的測試實用程序$ composer require dhl/sdk-api-unified-location-finder$ composer remove dhl/sdk-api-unified-location-finder$ ./vendor/bin/phpunit -c test/phpunit.xmlDPDHL統一位置查找器API SDK支持以下功能:
圖書館的組件適合消費
$ consumerKey = ' Your application consumer key ' ;
$ logger = new Psr Log NullLogger ();
$ serviceFactory = new Dhl Sdk UnifiedLocationFinder Service ServiceFactory ();
$ service = $ serviceFactory -> createLocationFinderService ( $ consumerKey , $ logger );
try {
/** @var DhlSdkUnifiedLocationFinderApiDataLocationInterface $locations */
$ locations = $ service -> getPickUpLocations (
$ countryCode = ' DE ' ,
$ postalCode = ' 04129 ' ,
$ city = ' Leipzig ' ,
$ street = ' Nonnenstraße 11d ' ,
$ service = ' parcel-eu ' ,
$ radius = 2000 ,
$ limit = 25
);
} catch ( Dhl Sdk UnifiedLocationFinder Exception ServiceException $ e ) {
// handle errors
}SDK只會拋出類型DhlSdkUnifiedLocationFinderExceptionServiceException的例外。 ServiceException的子類可用於描述發生的錯誤類型。
a DhlSdkUnifiedLocationFinderExceptionDetailedServiceException表明該異常包含一個適合顯示給最終用戶的人類可讀錯誤消息。