AeroFetch is a powerful yet lightweight PHP library designed to seamlessly retrieve airport and airline details without requiring an external database or API.
- ⚡ Fast & Efficient – Data is stored in optimized CSV files, enabling quick lookups without unnecessary overhead.
- 📅 Regular Updates – Stay up-to-date with the latest airport and airline information, thanks to frequent data refreshes.
- 🔗 Easy Integration – Simple API methods allow effortless retrieval of details using IATA/ICAO codes, country, or name.
You can easily install AeroFetch using Composer:
composer require tiagohillebrandt/aerofetch
That's it! Once installed, you can start retrieving airport and airline details with ease. 🚀
Retrieve airport information by IATA code.
<?php
use THSCD\AeroFetch\Services\AirportService;
// Retrieve airport information by IATA code.
$airport = AirportService::get('GRU');
// Output the airport object.
print_r($airport);
// Output the airport information using the object properties.
echo sprintf(
'%s (%s) is located in %s, %s (%s)',
$airport->iataCode,
$airport->name,
$airport->municipality,
$airport->country->name,
$airport->continent
);
Result:
THSCD\AeroFetch\Models\Airport Object
(
[name:protected] => Guarulhos - Governador André Franco Montoro International Airport
[iataCode:protected] => GRU
[icaoCode:protected] => SBGR
[continent:protected] => South America
[country:protected] => THSCD\AeroFetch\Models\Country Object
(
[name:protected] => Brazil
[alpha2Code:protected] => BR
[alpha3Code:protected] => BRA
[numericCode:protected] => 076
)
[region:protected] => BR-SP
[municipality:protected] => São Paulo
[latitude:protected] => -23.431944
[longitude:protected] => -46.467778
)
GRU (Guarulhos - Governador André Franco Montoro International Airport) is located in São Paulo, Brazil (South America)
You can find the list of ISO 3166-1 alpha-2 country codes here.
<?php
use THSCD\AeroFetch\Services\AirportService;
// Retrieve airline information by ISO 3166-1 alpha-2 country code.
$airports = AirportService::getBy('country', 'US'); // United States.
$airports = AirportService::getBy('continent', 'Europe');
Only airlines that are currently IATA members are supported.
<?php
use THSCD\AeroFetch\Services\AirlineService;
// Retrieve airline information by IATA designator.
$airline = AirlineService::get('AD');
// Output the airline object.
print_r($airline);
Result:
THSCD\AeroFetch\Models\Airline Object
(
[name:protected] => Azul Brazilian Airlines
[iataCode:protected] => AD
[icaoCode:protected] => AZU
[threeDigitCode:protected] => 577
[country:protected] => THSCD\AeroFetch\Models\Country Object
(
[name:protected] => Brazil
[alpha2Code:protected] => BR
[alpha3Code:protected] => BRA
[numericCode:protected] => 076
)
)
You can find the list of ISO 3166-1 alpha-2 country codes here.
<?php
use THSCD\AeroFetch\Services\AirlineService;
// Retrieve airline information by ISO 3166-1 alpha-2 country code.
$airlines = AirlineService::getBy('country', 'BR'); // Brazil.
Datasets used by AeroFetch for airport and airline information:
Dataset | Last Updated | Source |
---|---|---|
Airports | 2025-02-26 | OurAirports |
Airlines | 2025-02-27 | IATA Airline List (via web scraping) |