aheenam/countries
Laravel wrapper around umpirsky/country-list providing simple country name lookups. Retrieve all countries or a specific country by code, in the current locale or another language via allIn() and get(). Lightweight fallback to antonioribeiro/countries.
config/countries.php, allowing domain-specific extensions (e.g., adding territories or filtering by region).spatie/laravel-countries) scale better?/countries endpoint).composer require aheenam/countries
php artisan vendor:publish --provider="Aheenam\Countries\CountriesServiceProvider"
config/countries.php (e.g., add missing countries or remove unused ones).'countries' => [
'US' => 'United States',
'XX' => 'Custom Territory', // Extend as needed
],
use Aheenam\Countries\Facades\Countries;
$countries = Countries::all(); // Returns array of codes/names
$this->app->make('countries')->getCountries();
assertCount(249, Countries::all())).null).Illuminate\Support\Facades\Config changes).dd(Countries::all())); no complex dependencies.Cache::remember()).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Outdated country data | Incorrect user selections | Supplement with a cached API (e.g., RESTCountries). |
| Missing custom countries | Incomplete dropdowns | Extend config/countries.php manually. |
| Laravel version mismatch | Installation failures | Use a composer platform check or fork. |
| No error handling | Silent failures in production | Wrap usage in try-catch or add facade fallbacks. |
src/CountriesServiceProvider.php).How can I help you explore Laravel packages today?