kolyasapphire / travel-payouts
travelpayouts.com 的 PHP SDK (thewulf7/travel-payouts 分支)
v1.2.1
2020-08-17 23:05 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: *
- it-for-free/array_column: *
Requires (Dev)
- phpunit/php-invoker: >=1.1.0@stable
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-09-04 02:09:39 UTC
README
安装
Composer
composer require thewulf7/travel-payouts
或者在你的 composer.json 文件中 "require" 部分
"thewulf7/travel-payouts": "1.1.*"
使用
首先创建主要的 Travel 对象,并在其中传递你的 token
use thewulf7\travelPayouts\Travel; $travel = new Travel('YOUR TOKEN HERE');
然后你可以使用它来获取不同的服务
机票服务
$ticketService = $travel->getTicketsService(); //Get flights found by our users in the last 48 hours from LED to MOW. Return array consists of thewulf7\travelPayouts\Ticket objects. $flights = $ticketService->getLatestPrices('LED', 'MOW', false, 'rub', 'year', 1, 10);
查看文档 文档
飞行服务
$flightService = $travel->getFlightService(); $flightService ->setIp('127.0.0.1') ->setHost('aviasales.ru') ->setMarker('123') ->addPassenger('adults', 2) ->addSegment('LED', 'MOW', '2016-02-01'); $searchData = $flightService->search('ru', 'Y'); $searchResults = $flightService->getSearchResults($searchData['search_id']);
合作伙伴服务
$partnerService = $travel->getPartnerService(); //get user balance and currency of the balance list($balance, $currency) = $partnerService->getBalance();
数据服务
$dataService = $travel->getDataService(); //get all airports in the system $airports = $dataService->getAirports();