Download the PHP package anglemx/airports without Composer
On this page you can find all versions of the php package anglemx/airports. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anglemx/airports
More information about anglemx/airports
Files in anglemx/airports
Package airports
Short Description Auto-generated PHP abstract class that contains the global IATA Aiport database in pure PHP code.
License MIT
Homepage https://github.com/Angle/airports
Informations about the package 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 at 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
Usage
After installing it with Composer, simply import it into your code.
Find a single airport from a known IATA code
An airport entry contains:
Find all the airports in a country
Returns an array of airports for the specified country, with the IATA code as the key of each entry.
Get the full airport list
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
Requirements:
- ext-curl
- ext-json
Run the script at:
This will download the newest copy of the source airports.json
from the GitHub repository 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
The library is very simple, but we wrote some "tests" just for the heck of it. These require PHPUnit 4.
Credits
The source information is pulled from the ICAO Airport database published by mwgg at github.com/mwgg/Airports.
License
MIT License. © 2019 Angle Consulting.