anripuankare / atol-client-bundle
Symfony 扩展包,用于与 anripuankare/atol-client 集成
1.2.4
2022-03-16 11:35 UTC
Requires
- php: ^7.2 || ^8.1
- anripuankare/atol-client: ^1.6.0
- guzzlehttp/guzzle: ^6.0 || ^7.3.0
- jms/serializer-bundle: ^3.3 || ^3.4
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/yaml: ^5.4 || ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpunit/phpunit: ^5.7.10 || ^8.5
- symfony/symfony: ^5.4 || ^6.0
This package is not auto-updated.
Last update: 2024-09-26 18:48:35 UTC
README
为 https://github.com/lamoda/atol-client 提供的扩展包
安装
使用非常简单,如下所示
-
安装库
composer require anripuankare/atol-client-bundle
-
注册扩展包和必需的 JMS Serializer 扩展包
// Kernel public function registerBundles() { // ... $bundles[] = new \Lamoda\AtolClientBundle\AtolClientBundle(); $bundles[] = new \JMS\SerializerBundle\JMSSerializerBundle(); // ... }
-
在
services.yaml
中配置 Guzzle 客户端,例如services: guzzle: class: \GuzzleHttp\Client
-
配置 Symfony 以启用
validator
和enable_annotations
framework: validation: enabled: true enable_annotations: true
-
为任何需要的客户端添加配置
atol_client: clients: v3: # Version 3 of ATOL API. Currently deprecated and will not be supported by ATOL since 01.01.2019 version: !php/const Lamoda\AtolClientBundle\AtolClientBundle::API_CLIENT_VERSION_3 guzzle_client: guzzle # Link to the service that is guzzle guzzle_client_options: [] # Options for guzzle client (optional) base_url: 'http://atol_v3_url' # Base url of ATOL server callback_url: '' # Callback url for ATOL (see docs) default: version: !php/const Lamoda\AtolClientBundle\AtolClientBundle::API_CLIENT_VERSION_4 guzzle_client: guzzle # Link to the service that is guzzle guzzle_client_options: [] # Options for guzzle client (optional) base_url: 'http://atol_v4_url' # Base url of ATOL server
-
使用
@atol_client.v4
注入 atol 客户端作为依赖项