answear / gls-bundle

GLS api 的 Symfony 扩展包。

安装次数: 8,348

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:symfony-bundle

3.0.0 2024-09-06 08:02 UTC

This package is auto-updated.

Last update: 2024-09-06 08:04:59 UTC


README

Symfony 的 GLS 提货点集成。

安装

  • 使用 Composer 安装
composer require git@github.com:answear/gls-bundle.git

Answear\GlsBundle\AnswearGlsBundle::class => ['all' => true],
应该由 Symfony Flex 自动添加到您的 config/bundles.php 文件中。

设置

  • 提供所需配置数据:countryCode
# config/packages/answear_gls.yaml
answear_gls:
    countryCode: HU|SK|CZ|RO|SI|HR
    logger: yourCustomLoggerService #default: null

日志服务必须实现 Psr\Log\LoggerInterface 接口。

使用

获取包裹商店

/** @var \Answear\GlsBundle\Service\ParcelShopsService $parcelShopService **/
$parcelShopService->getParcelShopCollection();

将返回 \Answear\GlsBundle\Response\DTO\ParcelShop[] 数组。

错误处理

  • Answear\GlsBundle\Exception\ServiceUnavailableException 用于所有 GuzzleException

最后备注

请随意提交带有新功能、改进或错误修复的拉取请求。Answear 团队将感谢任何评论。