ijeffro/laravel-aircrafts

Laravel Aircrafts is a bundle for Laravel, providing Iata Code ISO 3166 3 and country codes for all the aircrafts.
98 2
Install
composer require ijeffro/laravel-aircrafts
Latest Version:v1.0.1
PHP:^8.2
Laravel:12 · 13
License:MIT
Last Updated:Oct 5, 2026
Links: GitHub  ·  Packagist
Maintainer: ijeffro

Laravel Aircrafts — IATA aircraft type designators (320, 738, 388, …) for Laravel 12 and 13.

  • No database required. Look aircraft types up through a facade backed by an in-memory dataset.
  • Typed results. Every lookup returns readonly Aircraft objects in Laravel collections keyed by code.
  • Validation rule. new AircraftCode accepts known codes only.
  • Optional table. Publish a migration and seed an aircrafts table.

📦 Installation

composer require flairuk/laravel-aircrafts

Requires PHP 8.2 or later with Laravel 12, or PHP 8.3 or later with Laravel 13.

Laravel discovers the service provider and the Aircrafts facade automatically.

🚀 Usage

use FLAIRUK\Aircrafts\Facades\Aircrafts;

Aircrafts::find('738');          // Aircraft { id: 55, code: "738", name: "Boeing 737-800" }
Aircrafts::findOrFail('388');    // throws ItemNotFoundException for unknown codes
Aircrafts::exists('73h');        // true (codes are case-insensitive)
Aircrafts::findById(55);

Aircrafts::all();                // Collection<string, Aircraft> keyed by code
Aircrafts::search('a380');       // matches on name or exact code
Aircrafts::codes();

Select options

Aircrafts::options();            // ['738' => 'Boeing 737-800', ...] sorted by name

Validation

use FLAIRUK\Aircrafts\Rules\AircraftCode;

$request->validate(['equipment' => ['required', new AircraftCode]]);

💾 Database table (optional)

php artisan aircrafts:install             # publish config + migration, then ask to migrate and seed
php artisan aircrafts:install --migrate   # migrate and seed without asking
php artisan aircrafts:seed            # insert / update (safe to re-run)
php artisan aircrafts:seed --prune    # also delete rows no longer in the dataset

You can also call the seeder from your own DatabaseSeeder:

$this->call(\FLAIRUK\Aircrafts\Database\AircraftsSeeder::class);

The bundled FLAIRUK\Aircrafts\Models\Aircraft model gives you Aircraft::code('738')->first(). The table name and connection come from AIRCRAFTS_TABLE and AIRCRAFTS_DB_CONNECTION, or from the published config.

🔄 Upgrading from dev-master

Version 1.0 is a rewrite. Breaking changes:

dev-master 1.0
Package ijeffro/laravel-aircrafts flairuk/laravel-aircrafts
ijeffro\Aircrafts\… namespace FLAIRUK\Aircrafts\…
Facade ijeffro\Aircrafts\AircraftsFacade FLAIRUK\Aircrafts\Facades\Aircrafts (auto-discovered)
Aircrafts::getList($sort) (array) Aircrafts::all()->sortBy($property, SORT_NATURAL | SORT_FLAG_CASE) (Collection of Aircraft)
Aircrafts::getOne($id) Aircrafts::findById($id) or Aircrafts::find($code)
Aircrafts::getListForSelect() (keyed by id) Aircrafts::options('id')
php artisan aircrafts:migration php artisan aircrafts:install / aircrafts:seed
Config key aircrafts.table_name aircrafts.table
updated field (a 2015 import timestamp) removed

Row ids are unchanged.

🧪 Testing

composer test

📄 License

MIT. See LICENSE.

Related Packages

ijeffro/laravel-airlines

Laravel Airlines is a bundle for Laravel, providing Iata Code ISO 3166 3 and cou...

8,456 3
ijeffro/laravel-cities

Laravel Cities is a bundle for Laravel, providing Iata Code ISO 3166 3 and count...

8,280 11
ijeffro/laravel-airports

Laravel Airports is a bundle for Laravel, providing Iata Code ISO 3166 3 and cou...

3,625 4
cobaltgrid/aviation-weather

A simple (Laravel compatible) library for fetching and decoding METARs

48 4
lartie/airports

Airports for Laravel

22 3

Version History

Version Released PHP Laravel License
v1.0.1 ^8.2 ^12.0|^13.0 MIT
v1.0.0 ^8.2 ^12.0|^13.0 MIT