answear/overseas-bundle
最新稳定版本:4.1.0
Composer 安装命令:
composer require answear/overseas-bundle
包简介
Symfony bundle for Overseas api.
README 文档
README
Overseas integration for Symfony.
Documentation of the API can be found here: https://api.overseas.hr/apiinfo
Installation
- install with Composer
composer require git@github.com:answear/overseas-bundle.git
Answear\OverseasBundle\AnswearOverseasBundle::class => ['all' => true],
should be added automatically to your config/bundles.php file by Symfony Flex.
Setup
- provide required config data:
environmentandapiKey
# config/packages/answear_overseas.yaml answear_overseas: environment: test|prod apiKey: yourApiKey logger: yourCustomLoggerService #default: null
Logger service must implement Psr\Log\LoggerInterface interface.
Usage
Get ParcelShops
@see https://api.overseas.hr/apiinfo#parcelshops
/** @var \Answear\OverseasBundle\Service\ParcelShopsService $parcelShopService **/ $parcelShopService->get();
will return \Answear\OverseasBundle\Response\DTO\ParcelShop[] array.
Get Places
@see https://api.overseas.hr/apiinfo#places
$zipCode = 12345; $name = 'name'; $approx = true; /** @var \Answear\OverseasBundle\Service\PlacesService $placesService **/ $placesService->get($zipCode, $name, $approx);
will return \Answear\OverseasBundle\Response\DTO\Place[] array narrowed down to params. or simply
$placesService->get();
to get all places.
Error handling
Answear\OverseasBundle\Exception\ServiceUnavailableExceptionfor allGuzzleExceptionMalformedResponseExceptionfor partner other errorsAnswear\OverseasBundle\Exception\BadRequestExceptionif validation failed or for error response
Final notes
Feel free to open pull requests with new features, improvements or bug fixes. The Answear team will be grateful for any comments.
统计信息
- 总下载量: 13.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-07