PHP code example of ozdemirburak / skyscanner-php

1. Go to this page and download the library: Download ozdemirburak/skyscanner-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ozdemirburak / skyscanner-php example snippets

 bash
$ composer 
 php
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);
 php
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'];
 php
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();
 php
use OzdemirBurak\SkyScanner\Localisation\Currency;

$currency = new Currency($apiKey = 'your-api-key');
$currencies = $currency->get();
 php
use OzdemirBurak\SkyScanner\Localisation\Locale;

$locale = new Locale($apiKey = 'your-api-key');
$locales = $locale->get();
 php
use OzdemirBurak\SkyScanner\Localisation\Market;

$market = new Market($apiKey = 'your-api-key'));
$market->setLocale('en-GB');
$countries = $market->get();
 php
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');