Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abame/travelpayouts
PHP SDK for travelpayouts
https://github.com/abame/travelpayouts
Last synced: about 2 months ago
JSON representation
PHP SDK for travelpayouts
- Host: GitHub
- URL: https://github.com/abame/travelpayouts
- Owner: abame
- License: mit
- Created: 2021-12-04T20:59:03.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T21:20:51.000Z (about 2 years ago)
- Last Synced: 2024-04-13T16:34:57.786Z (9 months ago)
- Language: PHP
- Homepage:
- Size: 6.74 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Travel Payouts PHP SDK
##CircleCI Status [![CircleCI](https://circleci.com/gh/abame/travelpayouts/tree/master.svg?style=svg)](https://circleci.com/gh/abame/travelpayouts/tree/master)
## Installation
### Composer
```
composer require abame/travelpayouts
```## Usage
First create a main Travel object and pass your token in it
```php
use TravelPayouts\Travel;$travel = new Travel('YOUR TOKEN HERE');
```
Then you can use it get different services### Tickets service
```php
$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](https://github.com/abame/travelpayouts/wiki/TicketService)
### Flight service
```php
$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
```php
$partnerService = $travel->getPartnerService();
//get user balance and currency of the balance
list($balance, $currency) = $partnerService->getBalance();
```### Data service
```php
$dataService = $travel->getDataService();
//get all airports in the system
$airports = $dataService->getAirports();
```