abame / travel-payouts
PHP SDK for travelpayouts.com
1.0.0
2022-02-27 12:54 UTC
Requires
- php: >=7.4
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: 7.4.*
- it-for-free/array_column: v1.1.*
Requires (Dev)
- friendsofphp/php-cs-fixer: v3.3.*
- phpmd/phpmd: 2.10.*
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: 1.2.*
- phpunit/php-invoker: 3.1.*
- phpunit/phpunit: 9.5.*
- slevomat/coding-standard: 7.0.*
- squizlabs/php_codesniffer: 3.6.*
- vimeo/psalm: ^4.14
This package is auto-updated.
Last update: 2024-11-09 01:43:16 UTC
README
Installation
Composer
composer require abame/travelpayouts
Usage
First create a main Travel object and pass your token in it
use TravelPayouts\Travel; $travel = new Travel('YOUR TOKEN HERE');
Then you can use it get different services
Tickets service
$ticketService = $travel->getTicketsService(); //Get flights found by our users in the last 48 hours from PAR to FRA. Return array consists of TravelPayouts\Ticket objects. $flights = $ticketService->getLatestPrices('PAR', 'FRA', false, 'eur', 'year', 1, 10);
See documentation
Flight service
$flightService = $travel->getFlightService(); $flightService ->setIp('127.0.0.1') ->setHost('aviasales.ru') ->setMarker('123') ->addPassenger('adults', 2) ->addSegment('PAR', 'FRA', '2021-12-20'); $searchData = $flightService->search('ru', 'Y'); $searchResults = $flightService->getSearchResults($searchData['search_id']);
Partner service
$partnerService = $travel->getPartnerService(); //get user balance and currency of the balance list($balance, $currency) = $partnerService->getBalance();
Data service
$dataService = $travel->getDataService(); //get all airports in the system $airports = $dataService->getAirports();