Download the PHP package flairuk/laravel-airlines without Composer
On this page you can find all versions of the php package flairuk/laravel-airlines. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package laravel-airlines
**Laravel Airlines** โ IATA airline designators (`BA`, `EK`, `QF`, โฆ) for Laravel 12 and 13.
- **No database required.** Look airlines up through a facade backed by an in-memory dataset.
- **Typed results.** Every lookup returns readonly `Airline` objects in Laravel collections.
- **Validation rule.** `new AirlineCode` accepts known designators only.
- **Optional table.** Publish a migration and seed an `airlines` table when other tables need to reference airlines.
๐ฆ Installation ยท ๐ Usage ยท ๐พ Database table ยท ๐ Upgrading
## ๐ฆ Installation 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 `Airlines` facade automatically.
## ๐ Usage IATA re-issues designators, so a code can belong to more than one airline. `find()` returns the first one and `allWithCode('1I')` returns every match. ### Select options ### Validation ### Dependency injection The facade resolves a singleton `FLAIRUK\Airlines\Airlines`, which you can type-hint instead:
## ๐พ Database table (optional) If you need airlines in your database, for example for foreign keys or joins: This command publishes `config/airlines.php` and a migration, then offers to run `migrate` and seed the table. You can re-seed at any time; it upserts rows, so re-running is safe: You can also call the seeder from your own `DatabaseSeeder`: Query the table through the bundled Eloquent model: The table name and connection come from `AIRLINES_TABLE` and `AIRLINES_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-airlines` | `flairuk/laravel-airlines` | | `ijeffro\Airlines\โฆ` namespace | `FLAIRUK\Airlines\โฆ` | | Facade `ijeffro\Airlines\AirlinesFacade` | `FLAIRUK\Airlines\Facades\Airlines` (auto-discovered) | | `Airlines::getList($sort)` (array) | `Airlines::all()->sortBy($property, SORT_NATURAL \| SORT_FLAG_CASE)` (Collection of `Airline`; properties are camelCase, e.g. `countryCode`) | | `Airlines::getOne($id)` | `Airlines::findById($id)` | | `Airlines::getListForSelect()` | `Airlines::options()` | | `php artisan airlines:migration` (generated seeder in `database/seeds`) | `php artisan airlines:install` / `airlines:seed` | | Config key `airlines.table_name` | `airlines.table` | | `charify` MySQL migration | removed. `code` and `country_code` are `CHAR` from the start | Row `id`s are unchanged, so existing foreign keys stay valid. The dataset was also cleaned: - 12 rows whose code was not a valid two-character designator (e.g. `&T`, `??`) were removed. - 4 exact duplicate rows were removed. - Missing country codes were filled in where the country was known. - Empty strings are now `null`. After upgrading, run `php artisan airlines:seed --prune` to update a seeded table. > [!WARNING] > The dev-master migration made `country_code` and `country_name` `NOT NULL`, but ten airlines in 1.0 have no country, so seeding an old table fails. Make the two columns nullable first, in a migration of your own: > > > > Or drop the old table and create it again with `php artisan airlines:install`.
## ๐งช Testing
## ๐ License MIT. See [LICENSE](LICENSE).
All versions of laravel-airlines with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
illuminate/console Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.0
The package flairuk/laravel-airlines contains the following files
Loading the files please wait ...