ttbooking / atol-client
ATOL API v4 client for PHP.
2.0.1
2024-02-21 14:46 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- jms/serializer: ^3.20
- symfony/validator: ^6.4 || ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.40
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0 || ^11.0
README
ATOL API v4 client for PHP
Installation
Usage is as simple as
-
Install library
composer require ttbooking/atol-client
-
Configure it (you will probably need some factory):
<?php declare(strict_types=1); namespace Lamoda\AtolClient\Tests\Helper; use GuzzleHttp\ClientInterface; use JMS\Serializer\Serializer; use JMS\Serializer\SerializerBuilder; use Lamoda\AtolClient\Converter\ObjectConverter; use Lamoda\AtolClient\V4\AtolApi; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validator\ValidatorInterface; final class AtolApiFactory { public static function create( ClientInterface $client, array $options, string $baseUrl ): AtolApi { $objectConvertor = new ObjectConverter( self::createSerializer(), self::createValidator() ); return new AtolApi( $objectConvertor, $client, $options, $baseUrl ); } private static function createSerializer(): Serializer { return SerializerBuilder::create() ->enableEnumSupport() ->build(); } private static function createValidator(): ValidatorInterface { return Validation::createValidatorBuilder() ->enableAttributeMapping() ->getValidator(); } }