abame/travel-payouts

PHP SDK for travelpayouts.com

1.0.0 2022-02-27 12:54 UTC

This package is auto-updated.

Last update: 2024-11-09 01:43:16 UTC


README

##CircleCI Status CircleCI

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();