Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Airports

Laravel Airports Laravel Package

ijeffro/laravel-airports

Laravel Airports provides IATA codes, ISO 3166-3 and country codes for airports, plus a service provider, facade, migration and seeder to populate an airports table. Install via Composer, publish config, migrate and seed for searchable airport data.

View on GitHub
Deep Wiki
Context7

IATA airport codes for Laravel: an in-memory lookup API, validation rule and optional database table.

Frequently asked questions about Laravel Airports
How do I install ijeffro/laravel-airports in Laravel?
Install it with Composer using composer require ijeffro/laravel-airports. On Laravel 12/13 with PHP 8.2+, package auto-discovery registers the service provider and facade, so no manual app.php edits are needed. If you want the optional database table, publish the config and migration, then run the install and seed commands. The old README guidance for dev-master applies only to the legacy Laravel 5 version.
Does laravel-airports support Laravel 11?
No, the current v1.0.0 line targets Laravel 12/13 and requires PHP 8.2 or newer. The legacy dev-master branch documented in the README was for Laravel 5 only and is not a supported path for modern applications. Teams on Laravel 11 or older must upgrade the host application before adopting this package.
How do I get airport details by IATA code?
Use the Airports facade or inject the package contract and call Airports::find with a code such as LHR. It returns an immutable Airport value object from the in-memory dataset, or null when the code is unknown. Use findOrFail when an unknown code should raise an exception. The value object also gives you the airport's country and ISO codes.
What is the difference between find() and findOrFail() in Laravel Airports?
find() returns null for an unknown IATA code, while findOrFail() throws an exception. Use find() for optional lookups such as filtering or display, and use findOrFail() when a missing airport is a data integrity error, such as importing a flight record. Both read from the same in-memory dataset and do not hit the database by default.
How do I validate an IATA airport code in a Laravel form request?
Use the package's AirportCode validation rule in Form Requests or inline validators. It checks that the submitted value is a known IATA airport code rather than just a three-letter string. Add feature tests for valid codes such as LHR and for invalid or normalized values according to your input policy.
Can I still store airports in a database table with Eloquent?
Yes, but the default path is in-memory and does not require a database table. Publish and run the migration, model, and seeder only when you need relational joins, reporting, or admin CRUD against airports. In that case treat the published airports table as read-only reference data and pin it to the package migration.
How do I populate the airports table after installing the package?
For the current package, use the provided Artisan install and seed commands, such as airports:install and airports:seed, to publish assets and populate the optional table. The older README's airports:migration plus DatabaseSeeder instructions describe the legacy workflow. After seeding, verify row counts and rerun the idempotent seeder in CI/CD when refreshing data.
How do I use Laravel Airports for autocomplete or a select dropdown?
Airports::search() is intended for autocomplete-style matching, while Airports::options() returns a list suitable for select dropdowns. Use search() for typeahead endpoints and options() for booking forms or admin filters. Keep the returned payload small and cache it at the edge if you expose public endpoints.
Is laravel-airports safe to use with Laravel Octane?
Because the dataset is an opcache-friendly PHP array loaded per process, it is generally Octane-friendly and avoids database round trips. You should still benchmark per-worker memory under your Octane or queue configuration, especially if many workers are running. The footprint is typically low to medium compared with ORM-backed reference tables.
How fresh is the airport dataset in laravel-airports?
The dataset is static and has no upstream sync, so freshness is your responsibility. Schedule periodic regeneration or reseeding from the package update path and decide whether stale reference data is acceptable for your SLA. If you need live airport status, routing, or pricing, pair this package with a domain-specific API rather than treating it as flight logic.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin