1. Go to this page and download the library: Download aaix/laravel-countries 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/ */
aaix / laravel-countries example snippets
use Aaix\LaravelCountries\Models\Country;
// Lookup
$de = Country::getByCode('DE'); // alpha-2, case-insensitive
$de = Country::whereIsoAlpha3('DEU')->first();
$de = Country::whereIso('276')->first(); // matches alpha-2, alpha-3, or numeric
// Names
$de->name; // current app locale, falls back to config fallback
$de->nameInLang('ja'); // "Germany" (falls back if 'ja' missing)
$de->official_name; // "Federal Republic of Germany"
$de->native_name; // "Deutschland"
// Bulk localized list — ready for dropdowns
Country::listInLang('de');
// Collection(['DE' => 'Deutschland', 'FR' => 'Frankreich', ...] sorted by name)
// Flag
$de->getFlagEmoji(); // 🇩🇪
$de->flag_colors_hex; // ['#000000', '#DD0000', '#FFCE00']
// Relations
$de->region; // CountryRegion
$de->coordinates; // CountryCoordinates
$de->extras; // CountryExtras (religions, orgs, sports, internet stats)
$de->geographical; // CountryGeographical (GeoJSON)