PHPackages                             mutebesi/globalcountries - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mutebesi/globalcountries

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mutebesi/globalcountries
========================

The best and most complete country information package for the PHP ecosystem.

v1.0.0(1mo ago)01↓100%MITPHPPHP ^8.2CI passing

Since May 9Pushed 1mo agoCompare

[ Source](https://github.com/mutebesi/Global-Countries-PHP)[ Packagist](https://packagist.org/packages/mutebesi/globalcountries)[ RSS](/packages/mutebesi-globalcountries/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

🌍 GlobalCountries (Premium Edition)
===================================

[](#-globalcountries-premium-edition)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cafcd702e1b77cb57af3248a997599ee12caf28df9c67881aa71583eac10b34c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d757465626573692f676c6f62616c636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mutebesi/globalcountries)[![Total Downloads](https://camo.githubusercontent.com/b154fc0ee49223f57d2644b501516bbd4a70dac66ed2a81aea778ff18f93be1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d757465626573692f676c6f62616c636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mutebesi/globalcountries)[![PHP Version Compliance](https://camo.githubusercontent.com/afd2d5b85fe2997ca0890027cea9ec43b98cd4dc3f040d84e367543c82ee8ce5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d757465626573692f676c6f62616c636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mutebesi/globalcountries)[![License](https://camo.githubusercontent.com/232e452350402181f0b9a347a44ccaf48767e27c98e22c3fc018f2518ebf0f1a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d757465626573692f676c6f62616c636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mutebesi/globalcountries)

**GlobalCountries** is the most complete, performant, and exhaustive country information package for the PHP ecosystem. It provides everything you need to build world-class global applications, featuring deeply detailed metadata for every country and territory on Earth.

---

📖 Table of Contents
-------------------

[](#-table-of-contents)

- [✨ Features](#-features)
- [🚀 Installation](#-installation)
- [💡 Quick Start](#-quick-start)
- [🔥 Pro Tips &amp; Advanced Usage](#-pro-tips--advanced-usage)
- [🔍 Searching &amp; Filtering](#-searching--filtering)
- [🗺️ Exhaustive Data Model](#-exhaustive-data-model)
- [🌍 Localization](#-localization)
- [📱 Phone Number Intelligence](#-phone-number-intelligence)
- [🏗️ Laravel Integration](#-laravel-integration)
- [📊 Performance](#-performance)
- [🎨 Frontend &amp; UI Utilities](#-frontend-&-ui-utilities)
- [🤝 Contributing](#-contributing)

---

✨ Features
----------

[](#-features)

- 🚀 **Extreme Performance**: Data is pre-compiled into optimized PHP arrays for near-instant access.
- 📦 **Exhaustive Metadata**: Deep details including population, GDP, Gini index, postal formats, and more.
- 🎨 **Visual Assets**: SVG/PNG flags, Emoji support, and Coat of Arms (SVG/PNG).
- 🌍 **Localization**: Multilingual support for country names and native scripts.
- 🔍 **Fluent API**: Powerful searching, filtering, and sorting with a "magical" interface.
- 🏗️ **Framework Agnostic**: Works perfectly in Vanilla PHP, Laravel, Symfony, and WordPress.
- 🎨 **Laravel Ready**: Includes Service Provider, Facades, Validation Rules, and Blade Components.

---

🚀 Installation
--------------

[](#-installation)

Clone this repository or include it in your project:

```
git clone https://github.com/mutebesi/Global-Countries-PHP.git
```

If using Composer:

```
composer require mutebesi/globalcountries
```

---

💡 Quick Start
-------------

[](#-quick-start)

```
use GlobalCountries\Countries;

// Get all countries
$countries = Countries::all();

// Find a specific country by ISO code (Alpha-2, Alpha-3, or Numeric)
$kenya = Countries::find('KE');

echo $kenya->name;         // Kenya
echo $kenya->capital;      // Nairobi
echo $kenya->population;   // 53771300
echo $kenya->flagEmoji();  // 🇰🇪
```

---

🔥 Pro Tips &amp; Advanced Usage
-------------------------------

[](#-pro-tips--advanced-usage)

Make your code feel like magic with our advanced fluent API:

```
// 1. One-liner to get all African country names joined by commas
echo Countries::whereContinent('Africa')->sortBy('name')->join(', ');

// 2. Pluck specific fields as an associative array [iso2 => callingCode]
$dialCodes = Countries::whereContinent('Europe')->pluck('callingCode', 'iso2');

// 3. Filter countries by population threshold
$giants = Countries::wherePopulationAbove(100000000); // 100M+

// 4. Guess country from phone and get its currency symbol instantly
echo Countries::guessFromPhone('+254712345678')->currencySymbol(); // KSh

// 5. Group by continent and get the count for each
foreach (Countries::all()->groupBy('continent') as $continent => $group) {
    echo "{$continent}: {$group->count()} countries";
}
```

---

🔍 Searching &amp; Filtering
---------------------------

[](#-searching--filtering)

```
// Filter by continent
$africa = Countries::whereContinent('Africa');

// Filter by language (ISO 639-2 or 639-1)
$spanishSpeaking = Countries::whereLanguage('spa');

// Get all EU member states
$eu = Countries::eu();

// Search by name or code (fuzzy search)
$results = Countries::search('United');

// Sorting
$sorted = Countries::all()->sortBy('population');
```

---

🗺️ Exhaustive Data Model
------------------------

[](#️-exhaustive-data-model)

Each `Country` object is an immutable DTO containing premium metadata:

### Basic Information

[](#basic-information)

- `$country->name`: Common name (e.g., "Kenya")
- `$country->officialName`: Official name (e.g., "Republic of Kenya")
- `$country->nativeNames`: Native names keyed by language code.
- `$country->iso2`, `$country->iso3`, `$country->isoNumeric`: ISO 3166-1 codes.
- `$country->ioc`, `$country->fifa`: Sports organization codes.
- `$country->slug`: URL-friendly identifier (e.g., "ke").

### Geography

[](#geography)

- `$country->continent`, `$country->region`, `$country->subregion`.
- `$country->latlng`: `[latitude, longitude]`.
- `$country->area`: Total area in km².
- `$country->borders`: Neighboring country ISO-3 codes.
- `$country->isLandlocked`: Boolean status.

### Political &amp; Demographics

[](#political--demographics)

- `$country->capital`: Capital city name.
- `$country->capitalLatLng`: Coordinates of the capital city.
- `$country->population`: Total population count.
- `$country->status`: Sovereignty status.
- `$country->isUnMember`, `$country->isIndependent`.

### Communication &amp; Visuals

[](#communication--visuals)

- `$country->callingCode`: International prefix (e.g., "+254").
- `$country->flagEmoji`, `$country->flagSvg`, `$country->flagPng`.
- `$country->coatOfArms`: Coat of Arms (SVG/PNG URL).

### Economics &amp; Technical

[](#economics--technical)

- `$country->currencyCode()`, `$country->currencySymbol()`, `$country->currencyName()`.
- `$country->gdp`: Gross Domestic Product.
- `$country->gini`: Gini index of income inequality.
- `$country->postalCodeFormat()`, `$country->postalCodeRegex()`.
- `$country->tlds`: Internet domains.
- `$country->drivingSide`: "left" or "right".
- `$country->timezones`: Supported timezones.
- `$country->startOfWeek`: e.g., "monday".

---

🏗️ Laravel Integration
----------------------

[](#️-laravel-integration)

### Validation Rule

[](#validation-rule)

```
use Illuminate\Validation\Rule;

$request->validate([
    'country_code' => ['required', Rule::country()],
]);
```

### Blade Component

[](#blade-component)

```

```

---

📊 Performance
-------------

[](#-performance)

OperationPerformance**Lookup (ISO)**&lt; 0.001ms**Filtering (All)**~0.02ms**Data Size**~1.5MB (Pre-compiled PHP)---

🎨 Frontend &amp; UI Utilities
-----------------------------

[](#-frontend--ui-utilities)

```
// Generate practical HTML selects with flags and grouping
foreach (Countries::all()->sortBy('name') as $country) {
    echo "{$country->flagEmoji} {$country->name}";
}
```

---

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance94

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94f8f511a2b8ee6afa6df6d5ea320da369600bff992b3f285a443b1cf8521bdb?d=identicon)[mutebesi](/maintainers/mutebesi)

---

Top Contributors

[![mutebesi](https://avatars.githubusercontent.com/u/63821642?v=4)](https://github.com/mutebesi "mutebesi (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mutebesi-globalcountries/health.svg)

```
[![Health](https://phpackages.com/badges/mutebesi-globalcountries/health.svg)](https://phpackages.com/packages/mutebesi-globalcountries)
```

###  Alternatives

[oh4d/laravel-accessibility

1114.4k](/packages/oh4d-laravel-accessibility)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
