1. Go to this page and download the library: Download ijeffro/laravel-airlines library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ijeffro / laravel-airlines example snippets
use FLAIRUK\Airlines\Facades\Airlines;
Airlines::find('BA'); // Airline { id: 301, code: "BA", name: "British Airways", countryCode: "GB", countryName: "United Kingdom" }
Airlines::findOrFail('BA'); // throws ItemNotFoundException for unknown codes
Airlines::exists('ba'); // true (codes are case-insensitive)
Airlines::findById(301);
Airlines::all(); // Collection<Airline>
Airlines::inCountry('GB'); // airlines registered in the UK
Airlines::search('british'); // matches on name or exact code
Airlines::codes(); // ['00', '01', ..., 'ZZ']
Airlines::options(); // [301 => 'British Airways', ...] keyed by id, sorted by name
Airlines::options('code'); // ['BA' => 'British Airways', ...]
use FLAIRUK\Airlines\Rules\AirlineCode;
$request->validate([
'airline' => ['
public function __construct(private \FLAIRUK\Airlines\Airlines $airlines) {}