lamoda / atol-client
ATOL API v3/v4/v5 client for php
Installs: 728
Dependents: 1
Suggesters: 0
Security: 0
Stars: 29
Watchers: 22
Forks: 12
Open Issues: 0
Requires
- php: ^7.4
- doctrine/annotations: ^1.7
- doctrine/cache: ^1.6
- guzzlehttp/guzzle: ^6.3 || ^7.5
- jms/serializer: ^3.4
- paillechat/php-enum: ~1.1.0
- symfony/validator: ^4.0 || ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpunit/phpunit: ^7.5.15
This package is auto-updated.
Last update: 2024-11-29 11:33:20 UTC
README
ATOL API v3/v4/v5 client for PHP
Installation
Usage is as simple as
-
Install library
composer require lamoda/atol-client
-
Better to use this library with symfony: https://github.com/lamoda/atol-client-bundle
-
But you can configure it manually (you will probably need some factory:
<?php declare(strict_types=1); namespace Lamoda\AtolClient\Tests\Helper; use GuzzleHttp\ClientInterface; use JMS\Serializer\Serializer; use Lamoda\AtolClient\Converter\ObjectConverter; use Lamoda\AtolClient\V3\AtolApi as AtolApiV3; use Lamoda\AtolClient\V4\AtolApi as AtolApiV4; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validator\ValidatorInterface; final class AtolApiFactory { /** * @deprecated */ public static function createV3( ClientInterface $client, array $options, string $baseUrl, string $groupCode ): AtolApiV3 { $objectConvertor = new ObjectConverter( self::createSerializer(), self::createValidator() ); return new AtolApiV3( $objectConvertor, $client, $options, $baseUrl, $groupCode ); } public static function createV4( ClientInterface $client, array $options, string $baseUrl ): AtolApiV4 { $objectConvertor = new ObjectConverter( self::createSerializer(), self::createValidator() ); return new AtolApiV4( $objectConvertor, $client, $options, $baseUrl ); } private static function createSerializer(): Serializer { return SerializerBuilder::create()->build(); } private static function createValidator(): ValidatorInterface { return Validation::createValidatorBuilder() ->enableAnnotationMapping() ->getValidator(); } }