avido / postnl-cif-rest-api-php-client
Post NL Webservices 的 PHP 客户端
0.4.6
2019-11-20 14:29 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ^6.2
- monolog/monolog: ^1.23
Requires (Dev)
- apigen/apigen: ^4.1
- phpunit/phpunit: *
- squizlabs/php_codesniffer: 2.*
README
PHP 版 PostNL CIF Rest Webservices API 客户端
开源 PHP 客户端,用于 [PostNL Rest CIF Webservices] (https://developer.postnl.nl/)。
安装
使用 composer 获取
运行命令
composer require avido/postnl-cif-rest-api-php-client
客户端初始化
require __DIR__ . '/vendor/autoload.php'; use Avido\PostNLCifClient\CifApi; $apikey = '--YOUR APIKEY --'; $client = new CifApi($apiKey);
示例:根据地址信息检索最近的位置
use Avido\PostNLCifClient\Request\DeliveryOptions\Locations\NearestLocationsRequest; // get nearest locations based on address information $request = new NearestLocationsRequest(); $request->setCountryCode('NL') ->setPostalcode('2132WT') ->setCity('Hoofddorp') ->setStreet('Siriusdreef') ->setHouseNumber(42) ->setDeliveryDate('01-01-2999') ->setOpeningTime('09:00:00') ->addDeliveryOptions('PG'); // load api "getAPI" based on required services. $response = $client->getAPI('location')->getNearestLocations($request);
单元测试
<phpunit> ... <php> <env name="PHP_APIKEY" value="--YOUR APIKEY--"/> </php> </phpunit>
实现状态
此库仍在开发中,新的发布/实现将随后跟来。