ijeffro/laravel-aircrafts
| 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 |
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
Aircraftobjects in Laravel collections keyed by code. - Validation rule.
new AircraftCodeaccepts known codes only. - Optional table. Publish a migration and seed an
aircraftstable.
📦 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
Laravel Airlines is a bundle for Laravel, providing Iata Code ISO 3166 3 and cou...
Laravel Cities is a bundle for Laravel, providing Iata Code ISO 3166 3 and count...
Laravel Airports is a bundle for Laravel, providing Iata Code ISO 3166 3 and cou...
A simple (Laravel compatible) library for fetching and decoding METARs
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.0.1 | ^8.2 | ^12.0| | MIT | |
| v1.0.0 | ^8.2 | ^12.0| | MIT |