lamoda / atol-client-bundle
用于与 lamoda/atol-client 集成的 Symfony Bundle
1.2.1
2023-10-04 08:02 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ^6.2 || ^7.3
- jms/serializer-bundle: ^3.3
- lamoda/atol-client: ^1.6.3
- symfony/config: ^4.0 || ^5.0
- symfony/dependency-injection: ^4.0 || ^5.0
- symfony/http-kernel: ^4.0 || ^5.0
- symfony/yaml: ^4.0 || ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpunit/phpunit: ^7.5.20
- symfony/symfony: ^4.2.9 || 5.4
This package is auto-updated.
Last update: 2024-09-04 10:16:36 UTC
README
针对 https://github.com/lamoda/atol-client 的 Bundle
安装
使用方法简单,例如
-
安装库
composer require lamoda/atol-client-bundle
-
注册 Bundle 和所需的 JMS Serializer Bundle
// 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 客户端作为依赖项注入