ozdemirburak/skyscanner-php

Unofficial PHP SDK for Skyscanner's API


Keywords
flight, travel, hotels, skyscanner, Trip, skyscanner-api, car hire, flights
License
MIT

Documentation

Unofficial PHP SDK for Skyscanner API

Latest Version on Packagist Software License Build Status Total Downloads

This is an unofficial PHP SDK for the Skyscanner API to support Flights, Car Hire, Hotels, Localisation, and Places services.

Currently, all of the services are implemented. Also tested all off the services except the Hotels one since could not find any valid API keys, and had no luck with contacting anyone from Skyscanner.

Install

Via Composer

$ composer require ozdemirburak/skyscanner-php

For PHP 7.0 and below, use ~1.0 instead.

Usage

Please see the wiki for more detailed information about the methods and the parameters.

You can find a simple demonstration of how to use the methods below, or check the tests for more advanced examples.

Flights: Live Pricing

use OzdemirBurak\SkyScanner\Travel\Flights\LivePricing;

$pricing = new LivePricing($apiKey = 'your-api-key');
$pricing->setParameters([
    'adults' => 1,
    'country' => 'GB',
    'currency' => 'GBP',
    'destinationPlace' => 'IST',
    'locale' => 'en-GB',
    'originPlace' => 'LHR',
    'outboundDate' => date('Y-m-d', strtotime('+1 week')),
    'stops' => 0
]);
$flights = $pricing->getFlights($onlyFirstAgentPerItinerary = true);

Flights: BrowseCache

use OzdemirBurak\SkyScanner\Travel\Flights\BrowseCache;

$cache = new BrowseCache($apiKey = 'your-api-key');
$cache->setParameters([
    'country' => 'TR',
    'currency' => 'TRY',
    'destinationPlace' => 'IST',
    'locale' => 'tr-TR',
    'originPlace' => 'LHR',
    'outboundPartialDate' => date('Y-m-d', strtotime('+1 week')),
]);
$quotes = $cache->getPrices()['Quotes'];

Car Hire: Live Pricing

use OzdemirBurak\SkyScanner\Travel\CarHire\LivePricing;

$pricing = new LivePricing($apiKey = 'your-api-key');
$pricing->setParameters([
    'country' => 'GB',
    'currency' => 'GBP',
    'dropoffplace' => 'ADB',
    'dropoffdatetime' => date('Y-m-d\TH:i', strtotime('+2 week')),
    'locale' => 'en-GB',
    'pickupplace' => 'IST',
    'pickupdatetime' => date('Y-m-d\TH:i', strtotime('+1 week')),
    'driverage' => 21
]);
$cars = $pricing->getCars();

Hotels: Live Pricing

use OzdemirBurak\SkyScanner\Travel\Hotels\LivePricing;

$pricing = new LivePricing($apiKey = 'your-api-key');
$pricing->setParameters([
    'country'       => 'TR',
    'currency'      => 'TRY',
    'entity_id'     => 27544008,
    'checkin_date'  => date('Y-m-d', strtotime('+1 week')),
    'checkout_date' => date('Y-m-d', strtotime('+2 week')),
    'locale'        => 'tr-TR'
]);
$hotels = $pricing->getHotels();

Localisation: Currency

use OzdemirBurak\SkyScanner\Localisation\Currency;

$currency = new Currency($apiKey = 'your-api-key');
$currencies = $currency->get();

Localisation: Locale

use OzdemirBurak\SkyScanner\Localisation\Locale;

$locale = new Locale($apiKey = 'your-api-key');
$locales = $locale->get();

Localisation: Market

use OzdemirBurak\SkyScanner\Localisation\Market;

$market = new Market($apiKey = 'your-api-key'));
$market->setLocale('en-GB');
$countries = $market->get();

Places

use OzdemirBurak\SkyScanner\PlacesService;

$places = new PlacesService($apiKey = 'your-api-key');
$geoCatalog = $places->get();
$list = $places->getList('UK', 'GBP', 'en-GB', 'istanbul');
$information = $places->getInformation('UK', 'GBP', 'en-GB', 'CDG-sky');
$hotels = $places->getHotels('UK', 'EUR', 'en-GB', 'paris');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.