PHPackages                             blakroku/countries - 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. blakroku/countries

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

blakroku/countries
==================

A lightweight PHP package that provides country data with powerful lookup functionality. Easily retrieve country details by name, code, domain extension, calling code, currency, and capital, all from a single source of truth.

v1.0.1(12mo ago)24MITPHPPHP ^7.4 || ^8.0

Since May 13Pushed 12mo ago1 watchersCompare

[ Source](https://github.com/blakroku/countries)[ Packagist](https://packagist.org/packages/blakroku/countries)[ RSS](/packages/blakroku-countries/feed)WikiDiscussions main Synced 1mo ago

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

Blakroku Countries
==================

[](#blakroku-countries)

A lightweight PHP package that provides country data with powerful lookup functionality. Easily retrieve country details by name, code, domain extension, calling code, currency, and capital, all from a single source of truth.

Installation
------------

[](#installation)

```
composer require blakroku/countries
```

Usage
-----

[](#usage)

```
use Blakroku\Countries\Countries\CountryManager;

$manager = new CountryManager();

// Get all countries
$countries = $manager->getAllCountries();

// Get country by name
$kenya = $manager->getCountryByName('Kenya');

// Get country by ISO code
$us = $manager->getCountryByCode('US');

// Get country by domain extension
$country = $manager->getCountryByDomainExtension('.fr');

// Get country by calling code
$country = $manager->getCountryByCallingCode('+49');

// Get country by currency
$country = $manager->getCountryByCurrency('EUR');

// Get country by capital
$country = $manager->getCountryByCapital('Tokyo');
```

Each lookup method returns a Country object or null if no match is found.

Features
--------

[](#features)

- Lookup by name, code, domain, currency, capital, and calling code
- Lazy-loaded from a JSON dataset
- Fast in-memory caching
- Clean and modern PHP design
- No external dependencies

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Composer

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Kwame Adoko](https://github.com/blakroku)
- All Contributors

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance50

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Every ~0 days

Total

2

Last Release

363d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b92c176d5e7e0e37bec4c1490b8bbb2490aee46b855ad8ba03b7275f9bf8f0fb?d=identicon)[blakroku](/maintainers/blakroku)

---

Top Contributors

[![blakroku](https://avatars.githubusercontent.com/u/24883390?v=4)](https://github.com/blakroku "blakroku (6 commits)")

---

Tags

countriesdomainregionsworld

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blakroku-countries/health.svg)

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

###  Alternatives

[tigitz/php-spellchecker

Provides an easy way to spellcheck multiple text source by many spellcheckers, directly from PHP

309498.4k1](/packages/tigitz-php-spellchecker)[shweshi/opengraph

A Laravel package to fetch website Open Graph metadata.

168736.5k1](/packages/shweshi-opengraph)[hashandsalt/kirby3-schema

Kirby 3 - Schema

171.7k1](/packages/hashandsalt-kirby3-schema)[wbrowar/craft-grid

A field that lets you content manage CSS Grid in Craft CMS.

171.1k](/packages/wbrowar-craft-grid)

PHPackages © 2026

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