anripuankare/atol-client-bundle

Symfony 扩展包,用于与 anripuankare/atol-client 集成

安装: 3

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 0

分支: 8

类型:symfony-bundle

1.2.4 2022-03-16 11:35 UTC

This package is not auto-updated.

Last update: 2024-09-26 18:48:35 UTC


README

https://github.com/lamoda/atol-client 提供的扩展包

Build Status Scrutinizer Code Quality Code Coverage Build Status

安装

使用非常简单,如下所示

  1. 安装库

    composer require anripuankare/atol-client-bundle
  2. 注册扩展包和必需的 JMS Serializer 扩展包

    // 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 客户端作为依赖项