ijeffro/laravel-aircrafts
Laravel Aircrafts is a Laravel package providing aircraft data with IATA codes, ISO 3166-3 codes, and country codes. It includes configuration, migration, and seeder support to create and populate an aircrafts table.
aircrafts:install --migrate command reveals an installable migration path that was not visible in the prior assessment. This materially changes the architecture story: the package can now be treated as seeded reference data in the database rather than purely in-memory/embedded data. For data-driven applications (aviation, logistics, travel), a DB-backed reference table is often preferable — it enables joins, foreign keys, admin correction, and reporting without forking vendor code.AircraftCode is a value object, not a loose string lookup. This aligns better with modern Laravel domain-driven patterns than the previously assumed facade-only Aircrafts::find($code) call. It gives us a natural seam for validation, casting, and custom Eloquent casts on our own models.738 in AircraftCode is a direct response to how JSON clients serialize numeric-looking codes. This is a real architecture fit improvement for API-first consumers, closing a class of 422/500 errors at the request boundary.sortBy mapping: Indicates configurable ordering semantics. Useful for deterministic dropdown ordering (e.g., by manufacturer vs. code), but it implies configuration surface we must own and document internally.php artisan aircrafts:install --migrate replaces manual provider/alias editing plus bespoke seeding. This is the single biggest feasibility improvement — it converts a half-day integration into roughly an hour.--migrate flag implies a publishable schema. We must decide explicitly between (a) static/embedded mode (zero DB footprint, no joins) and (b) migrated reference table (queryable, joinable, correctable). This is now a design decision rather than a constraint.738, 320, 777) returning as integers was not cosmetic — it breaks strict comparisons (=== '738'), array-key lookups, cache keys, and JSON contracts where clients expect strings. Any code we shipped against the prior version that compared loosely would have masked this; anything comparing strictly would have failed intermittently. Audit existing call sites for strict comparisons and string casts.codes() now returns strings for all codes. Consumers relying on integer returns for all-digit codes will see changed output. This is a semver-hygiene concern (behavior change shipped as v1.0.1) and signals the maintainer may not treat return types as a stable contract. Treat every minor/patch bump as potentially behavior-changing until proven otherwise.--migrate makes refreshing easier but not automatic.sortBy are now documented; error semantics for invalid codes and the migration's upgrade/rollback behavior are not.--migrate optional (static data fallback) or does the package now require the table? What is the supported upgrade path from the pre-1.0.1 static mode to migrated mode?codes() contract: Is string return now guaranteed and documented as stable, or should we cast defensively at the boundary regardless?AircraftCode semantics: On an unknown code, does it throw, return null, or return a null-object? Does integer acceptance extend to other numeric-ish fields?sortBy surface: Which keys are supported, is it config-driven or argument-driven, and is it stable API or incidental?aircrafts:install --migrate.AircraftCode removes a common ingestion failure when JSON clients post 738."vendor/package": "1.0.1"). Given the patch-level behavior change, floating constraints (^1.0, dev-master) are no longer acceptable.php artisan aircrafts:install --migrate in a controlled environment, inspect the generated schema, and promote it through the standard migration pipeline.class AircraftService {
public function findByCode(string|int $code): ?AircraftCode {
return Aircrafts::find((string) $code); // normalize at the boundary
}
}
Normalize to string inside the wrapper, not at every call site — this is the durable fix for the v1.0.1 bug class and protects us from future reversals.sortBy mapping rather than ad-hoc usort.codes() now string across the board — verify downstream producers and API response shapes.codes() output against current production output for a representative sample.738, 320, 777) covering both integer and string inputs, and for unknown-code handling.sortBy — the three gaps that previously required reverse-engineering.AircraftCode failure behavior.| Failure Scenario | Impact | Mitigation |
|---|---|---|
Strict comparison against previously-integer codes() output |
Silent lookup misses, wrong reference data displayed | Pin v1.0.1, normalize to string in the service wrapper, add regression tests for 738/320/777. |
| JSON client posts integer code | Rejected request / 422 or 500 | Now handled by AircraftCode integer acceptance — but still validate and cast at the boundary. |
| Migration run inconsistently across environments | Missing table, partial schema, divergent data | Treat vendor migration as a reviewed first-class migration; verify idempotency; run in CI. |
| Invalid aircraft code query | Silent failure or app crash | Validation layer + explicit null/exception contract in the wrapper. |
| Stale IATA data | Incorrect business logic | Quarterly review; re-run aircrafts:install --migrate (or equivalent refresh) on a schedule. |
Future patch changes codes() contract again |
Downstream breakage | Pin exact versions; diff output in CI before promoting upgrades. |
| Laravel version incompatibility | Package breaks in Laravel 8+ | Service-layer abstraction or fork. |
AircraftCode value object's failure semantics; internalizing that all codes are strings at the boundary.sortBy keys.How can I help you explore Laravel packages today?