rrkandala / skyscanner-php

Unofficial PHP SDK for Skyscanner's API that covers Flights, Car Hire, Localisation and Places services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unofficial PHP SDK for Skyscanner's API

Latest Version on Packagist Software License Build Status Total Downloads

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

Currently, all of the services are implemented and tested.

Note: Hotels service is missing, because it is currently unavailable.

Install

Via Composer

$ composer require ozdemirburak/skyscanner-php

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', $country = 'GB', $currency = 'GBP', $locale = 'en-GB');
$pricing->setParameters([
    'adults' => 1,
    'destinationplace' => 'IST',
    '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', $country = 'GB', $currency = 'GBP', $locale = 'en-GB');
$cache->setParameters([
    'destinationPlace' => 'IST',
    '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', $country = 'GB', $currency = 'GBP', $locale = 'en-GB');
$pricing->setParameters([
    'dropoffplace' => 'ADB',
    'dropoffdatetime' => date('Y-m-d\TH:i', strtotime('+2 week')),
    'pickupplace' => 'IST',
    'pickupdatetime' => date('Y-m-d\TH:i', strtotime('+1 week')),
    'driverage' => 21
]);
$cars = $pricing->getCars();

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', $locale = '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 and CONDUCT for details.

Security

If you discover any security related issues, please email mail@burakozdemir.co.uk instead of using the issue tracker.

Credits

License

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

About

Unofficial PHP SDK for Skyscanner's API that covers Flights, Car Hire, Localisation and Places services.

License:MIT License


Languages

Language:PHP 100.0%