Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.
Burak Ozdemir edited this page May 26, 2017 · 4 revisions

To get a list of places that match a query string,

use OzdemirBurak\SkyScanner\PlacesService;

$places = new PlacesService($apiKey = 'your-api-key');
$list = $places->getList('UK', 'GBP', 'en-GB', 'stockholm');

It will return data something like below.

array:5 [
  0 => {
    +"PlaceId": "STOC-sky"
    +"PlaceName": "Stockholm"
    +"CountryId": "SE-sky"
    +"RegionId": ""
    +"CityId": "STOC-sky"
    +"CountryName": "Sweden"
  }
  ...
]

To get information about a country, city or airport using its ID,

use OzdemirBurak\SkyScanner\PlacesService;

$places = new PlacesService($apiKey = 'your-api-key');
$list = $places->getInformation('UK', 'GBP', 'en-GB', 'CDG-sky'));

It will return data something like below.

array:1 [
  0 => {
    +"PlaceId": "CDG-sky"
    +"PlaceName": "Paris Charles de Gaulle"
    +"CountryId": "FR-sky"
    +"CityId": "PARI-sky"
    +"CountryName": "France"
  }
]

To retrieve a list of hotels and/or geographical locations which can then be used with the hotels and car hire APIs,

use OzdemirBurak\SkyScanner\PlacesService;

$places = new PlacesService($apiKey = 'your-api-key');
$list = $places->getHotels('UK', 'EUR', 'en-GB', 'paris');

It will return data something like below.

{
  +"places": array:3 [
    0 => {
      +"place_id": 1
      +"city_name": "Paris"
      +"admin_level1": "Île-de-France"
      +"country_name": "France"
    }
    ...
  ]
  +"results": array:10 [
    0 => {
      +"display_name": "Paris"
      +"individual_id": "27539733"
      +"geo_type": "City"
      +"localised_geo_type": "City"
      +"is_bookable": false
      +"parent_place": {
        +"place_id": 1
        +"city_name": "Paris"
        +"admin_level1": "Île-de-France"
        +"country_name": "France"
      }
    }
  ...
  ]
}

To get the full list of all the places that SkyScanner supports, Note that, you need to contact them to request access to use this feature.

use OzdemirBurak\SkyScanner\PlacesService;

$places = new PlacesService($apiKey = 'your-api-key');
$list = $places->get();

To learn more, check the official documentation.

Clone this wiki locally