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 :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表明该异常包含一个适合显示给最终用户的人类可读错误消息。