PHP code example of marcgoertz / flight-duration

1. Go to this page and download the library: Download marcgoertz/flight-duration 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/ */

    

marcgoertz / flight-duration example snippets


use Marcgoertz\FlightDuration;

$flightDuration = new FlightDuration();
$duration = $flightDuration->getDuration(
    '2023-05-01T10:30',      // Departure time
    '2023-05-01T14:45',      // Arrival time
    'FRA',                   // Departure airport
    'JFK'                    // Destination airport
);

print_r($duration);
shell
curl "http://localhost:8000/?from=2023-05-01T10:30&to=2023-05-01T14:45&departureAirport=FRA&destinationAirport=JFK"