lamoda/atol-client-bundle

用于与 lamoda/atol-client 集成的 Symfony Bundle

安装: 9

依赖者: 0

建议者: 0

安全性: 0

星星: 7

关注者: 21

分支: 8

开放问题: 0

类型:symfony-bundle

1.2.1 2023-10-04 08:02 UTC

This package is auto-updated.

Last update: 2024-09-04 10:16:36 UTC


README

针对 https://github.com/lamoda/atol-client 的 Bundle

Build Status Scrutinizer Code Quality Code Coverage Build Status

安装

使用方法简单,例如

  1. 安装库

    composer require lamoda/atol-client-bundle
  2. 注册 Bundle 和所需的 JMS Serializer Bundle

    // Kernel
    
    public function registerBundles()
    {
    	// ...
    	$bundles[] = new \Lamoda\AtolClientBundle\AtolClientBundle();
    	$bundles[] = new \JMS\SerializerBundle\JMSSerializerBundle();
    	// ...
    }
  3. services.yaml 中配置 Guzzle 客户端,例如

    services:
        guzzle:
            class: \GuzzleHttp\Client
  4. 配置 Symfony 以启用 validatorenable_annotations

    framework:
        validation:
            enabled: true
            enable_annotations: true
  5. 为所需的任何客户端添加配置

    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
  6. 使用 @atol_client.v4 将 atol 客户端作为依赖项注入