answear / acs-bundle
Symfony 对 ACS API 的扩展包。
2.1.1
2024-09-12 07:54 UTC
Requires
- php: >=7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.0|^7.0
- marc-mabe/php-enum: ^3.0|^4.3
- psr/log: ^1.0
- symfony/http-kernel: ^5.4|^6.0|^6.4
- symfony/property-info: ^5.4|^6.0|^6.4
- symfony/serializer: ^5.4|^6.0|^6.4
- webmozart/assert: ^1.10
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.58
- matthiasnoback/symfony-config-test: ^4.3
- phpro/grumphp: ^1.5.0|^2.5
- phpstan/phpstan: ^1.11
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-master
- symfony/phpunit-bridge: 6.4.*
This package is auto-updated.
Last update: 2024-09-12 07:55:33 UTC
README
Symfony 的 ACS 取货点集成。
安装
- 使用 Composer 安装
composer require git@github.com:answear/acs-bundle.git
Answear\AcsBundle\AnswearAcsBundle::class => ['all' => true],
应自动添加到您的 config/bundles.php
文件中,由 Symfony Flex 完成。
设置
- 提供所需的配置数据:
apiKey
、companyId
、userId
、userPassword
# config/packages/answear_acs.yaml answear_gls: apiKey: companyId: companyPassword: userId: userPassword: language: //default GR
使用
获取包裹商店
/** @var \Answear\AcsBundle\Service\ParcelShopsService $parcelShopService **/ $parcelShopService->getList(CountryIdEnum $countryId, ?int $kind = null);
将返回 \Answear\AcsBundle\Response\DTO\ParcelShop[]
数组。
其中 countryId
是希腊或塞浦路斯,kind
是根据 ACS 文档的商店类型,null
表示所有类型
错误处理
Answear\AcsBundle\Exception\ServiceUnavailable
用于所有GuzzleException
Answear\AcsBundle\Exception\MalformedResponse
用于不正确的响应
最后的话
请随意提交包含新功能、改进或错误修复的 pull request。Answear 团队将非常感激任何评论。