PHPackages                             marcgoertz/flight-duration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. marcgoertz/flight-duration

ActiveLibrary

marcgoertz/flight-duration
==========================

Calculate actual flight durations between airports using timezone data from OpenFlights.org.

1.0.0(1y ago)213MITPHPPHP &gt;=8.0CI passing

Since May 4Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/mrcgrtz/flight-duration)[ Packagist](https://packagist.org/packages/marcgoertz/flight-duration)[ RSS](/packages/marcgoertz-flight-duration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

Flight Duration (PHP)
=====================

[](#flight-duration-php)

[![PHP Composer](https://github.com/mrcgrtz/flight-duration/actions/workflows/php.yml/badge.svg)](https://github.com/mrcgrtz/flight-duration/actions/workflows/php.yml)[![MIT license](https://camo.githubusercontent.com/8814e8d016b7cff4b4c69dcc7e26826e1dc0489a914f508976f3f2f6dc359ccb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d72636772747a2f666c696768742d6475726174696f6e)](https://github.com/mrcgrtz/flight-duration/blob/main/LICENSE.md)

Calculate actual flight durations between airports using timezone data from [OpenFlights.org](https://openflights.org/data.php).

Features
--------

[](#features)

- Calculate flight durations considering different timezones
- Support for over 12,000 airports worldwide
- Simple REST API with JSON responses
- OpenAPI documentation

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

```
composer require marcgoertz/flight-duration
```

### Manual Installation

[](#manual-installation)

1. Clone the repository:

    ```
    git clone https://github.com/mrcgrtz/flight-duration.git
    cd flight-duration
    ```
2. Install dependencies:

    ```
    composer install
    ```

Usage
-----

[](#usage)

### Starting the Server

[](#starting-the-server)

```
# Using PHP's built-in server
composer start

# Using ddev
ddev start
```

### API Parameters

[](#api-parameters)

ParameterDescriptionFormatExample`from`Departure datetimeYYYY-MM-DDTHH:MM`2023-05-01T10:30``to`Arrival datetimeYYYY-MM-DDTHH:MM`2023-05-01T14:45``departureAirport`IATA code of departure airport3 uppercase letters`FRA``destinationAirport`IATA code of destination airport3 uppercase letters`JFK`### Example Requests

[](#example-requests)

Using [curl](https://curl.se/):

```
curl "http://localhost:8000/?from=2023-05-01T10:30&to=2023-05-01T14:45&departureAirport=FRA&destinationAirport=JFK"
```

Using [Curlie](https://github.com/rs/curlie):

```
curlie http://localhost:8000/ from==2023-05-01T10:30 to==2023-05-01T14:45 departureAirport==FRA destinationAirport==JFK
```

### Example Response

[](#example-response)

```
{
  "from": "2023-05-01T10:30+02:00",
  "to": "2023-05-01T14:45-04:00",
  "duration": "P0DT8H15M"
}
```

Library Usage
-------------

[](#library-usage)

You can also use `FlightDuration` as a library in your PHP project:

```
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);
```

Response Format
---------------

[](#response-format)

The API returns a JSON object with three properties:

- `from`: ISO 8601 formatted departure time with timezone
- `to`: ISO 8601 formatted arrival time with timezone
- `duration`: ISO 8601 duration format (PnYnMnDTnHnMnS)

Development
-----------

[](#development)

### Requirements

[](#requirements)

- PHP 8.0 or higher
- Composer

Credits
-------

[](#credits)

The airport data is provided by [OpenFlights.org](https://openflights.org/data.php).

License
-------

[](#license)

MIT © Marc Görtz

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance63

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

374d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce6a7b2b8a8973161ed58b556066cd6a7a535beb380fa1f51ac242690a6b4d0b?d=identicon)[mrcgrtz](/maintainers/mrcgrtz)

---

Top Contributors

[![mrcgrtz](https://avatars.githubusercontent.com/u/166190?v=4)](https://github.com/mrcgrtz "mrcgrtz (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

---

Tags

flight-durationsopenflightstimezone-information

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/marcgoertz-flight-duration/health.svg)

```
[![Health](https://phpackages.com/badges/marcgoertz-flight-duration/health.svg)](https://phpackages.com/packages/marcgoertz-flight-duration)
```

###  Alternatives

[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)[brandembassy/slim-nette-extension

19190.2k](/packages/brandembassy-slim-nette-extension)[vesp/core

Vesp core library to make backend simple

243.8k5](/packages/vesp-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
