PHPackages                             anglemx/airports - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. anglemx/airports

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

anglemx/airports
================

Auto-generated PHP abstract class that contains the global IATA Aiport database in pure PHP code.

v1.2.1(8mo ago)511.2k—10%3[1 issues](https://github.com/Angle/airports/issues)MITPHPPHP &gt;=5.3CI failing

Since Jul 27Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/Angle/airports)[ Packagist](https://packagist.org/packages/anglemx/airports)[ Docs](https://github.com/Angle/airports)[ RSS](/packages/anglemx-airports/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Airports
========

[](#airports)

This library is an auto-generated PHP abstract class that contains the global IATA Aiport database in pure PHP code.

The database is pulled from the ICAO Airport database published by [mwgg](https://github.com/mwgg) at [github.com/mwgg/Airports](https://github.com/mwgg/Airports).

Last update: 2024-02-09

**Note:** we haven't tested if this is faster than loading from a raw .json file or a SQLite database. However, it definitely simplifies our deployment processes. Please feel free to run benchmarks and submit pull requests!

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

[](#installation)

```
composer require anglemx/airports
```

Usage
-----

[](#usage)

After installing it with Composer, simply import it into your code.

```
use Angle\Airports\AirportLibrary;
```

### Find a single airport from a known IATA code

[](#find-a-single-airport-from-a-known-iata-code)

```
/** @var \Angle\Airports\Airport $airport */
$airport = AirportLibrary::find('LMM');
```

An airport entry contains:

```
var_dump($airport);

/**
object(Angle\Airports\Airport)(10) {
  ["icao"]=>
  string(4) "MMLM"
  ["iata"]=>
  string(3) "LMM"
  ["name"]=>
  string(38) "Valle del Fuerte International Airport"
  ["city"]=>
  string(10) "Los Mochis"
  ["state"]=>
  string(7) "Sinaloa"
  ["country"]=>
  string(2) "MX"
  ["elevation"]=>
  int(16)
  ["lat"]=>
  float(25.6851997375)
  ["lon"]=>
  float(-109.081001282)
  ["tz"]=>
  string(16) "America/Mazatlan"
}
*/

// If needed, the `Airport` object can also be casted as an array:

var_dump($airport->toArray());

/**
array(10) {
  ["iata"]=>
  string(3) "LMM"
  ["icao"]=>
  string(4) "MMLM"
  ["name"]=>
  string(38) "Valle del Fuerte International Airport"
  ["city"]=>
  string(10) "Los Mochis"
  ["state"]=>
  string(7) "Sinaloa"
  ["country"]=>
  string(2) "MX"
  ["elevation"]=>
  int(16)
  ["lat"]=>
  float(25.6851997375)
  ["lon"]=>
  float(-109.081001282)
  ["tz"]=>
  string(16) "America/Mazatlan"
}
*/

```

### Find all the airports in a country

[](#find-all-the-airports-in-a-country)

```
/** @var \Angle\Airports\Airport[] $airports */
$airports = AirportLibrary::findByCountry('MX');
```

Returns an array of airports for the specified country, with the IATA code as the key of each entry.

### Get the full airport list

[](#get-the-full-airport-list)

```
$airports = AirportLibrary::getFullList();
```

Returns an array of all the airports (as arrays, not objects) in the list, with the IATA code as the key of each entry.

Build / Update
--------------

[](#build--update)

Requirements:

- ext-curl
- ext-json

Run the script at:

```
$> php build/build.php
```

This will download the newest copy of the source `airports.json` [from the GitHub repository](https://github.com/mwgg/Airports/raw/master/airports.json) into a temporary file, it will parse it and it will replace the placeholder found in `build/AirportLibrary.php` to write the final auto-generated file to `src/AirportLibrary.php`.

**Do not modify the file in `src/AirportLibrary.php` directly.** Instead modify the *template* file in the `build/` directory, and then run the `build.php` script.

We're targeting PHP 5.3 even thought it's quite old at this point, in order to maintain compatibility with older codebases. This means:

- Not using PHP7's constant arrays or any other modern features that could speed up the performance of the library.
- Using PHPUnit 4 even thought it's deprecated by now.

Testing
-------

[](#testing)

The library is *very* simple, but we wrote some "tests" just for the heck of it. These require PHPUnit 4.

```
$> composer install
```

```
$> ./vendor/bin/phpunit tests/AirportLibraryTest
```

Credits
-------

[](#credits)

The source information is pulled from the ICAO Airport database published by [mwgg](https://github.com/mwgg) at [github.com/mwgg/Airports](https://github.com/mwgg/Airports).

License
-------

[](#license)

MIT License. © 2019 [Angle Consulting](https://angle.mx).

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance56

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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

Every ~447 days

Recently: every ~559 days

Total

6

Last Release

250d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/936483?v=4)[Edmundo Fuentes](/maintainers/edmundofuentes)[@edmundofuentes](https://github.com/edmundofuentes)

---

Top Contributors

[![edmundofuentes](https://avatars.githubusercontent.com/u/936483?v=4)](https://github.com/edmundofuentes "edmundofuentes (8 commits)")[![jplarar](https://avatars.githubusercontent.com/u/7461991?v=4)](https://github.com/jplarar "jplarar (2 commits)")[![alexhg11](https://avatars.githubusercontent.com/u/6727192?v=4)](https://github.com/alexhg11 "alexhg11 (1 commits)")

---

Tags

airportsiataangle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anglemx-airports/health.svg)

```
[![Health](https://phpackages.com/badges/anglemx-airports/health.svg)](https://phpackages.com/packages/anglemx-airports)
```

###  Alternatives

[mwgg/airports

A JSON collection of ~29k entries with basic information about nearly every airport and landing strip in the world

7261.2k](/packages/mwgg-airports)

PHPackages © 2026

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