PHPackages                             sukohi/country-code - 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. sukohi/country-code

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

sukohi/country-code
===================

Country codes based on iso 3166-1 like country name, alpha-2 code, alpha-3 code or numeric code for PHP

1.0.1(9y ago)11.5k1MITPHP

Since Sep 9Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SUKOHI/CountryCode)[ Packagist](https://packagist.org/packages/sukohi/country-code)[ RSS](/packages/sukohi-country-code/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (4)Used By (0)

CountryCode
===========

[](#countrycode)

Country codes based on iso 3166-1 like country name, alpha-2 code, alpha-3 code or numeric code for PHP

[Demo](http://demo-laravel52.capilano-fw.com/country_code)

Installation
============

[](#installation)

Execute composer command.

```
composer require sukohi/country-code:1.*

```

Usage
=====

[](#usage)

```
$country_code = new \Sukohi\CountryCode\CountryCode();
$mode = 'alpha-2';  // or alpha-3, numeric (skippable)

// Array
$country_data = $country_code->getArray($mode);
print_r($country_data);

// Country Name
$key = 'US';
$mode = 'alpha-2';  // or alpha-3, numeric (skippable)
$locale = 'en';     // (skippable)
echo $country_code->countryName($key, $mode, $locale);  // United States

```

Contribution
============

[](#contribution)

If you can translate country names to your mother language, please add the names in `assets/csv/country_codes.csv`.
And I'm glad if you would create a pull request.
Thank you!

License
=======

[](#license)

This package is licensed under the MIT License.
Copyright 2016 Sukohi Kuhoh

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~7 days

Total

3

Last Release

3567d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2980d59b309d45df3f2e6e51b1d336614da063240b8f76f873f287cd745ec5db?d=identicon)[Sukohi](/maintainers/Sukohi)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/sukohi-country-code/health.svg)

```
[![Health](https://phpackages.com/badges/sukohi-country-code/health.svg)](https://phpackages.com/packages/sukohi-country-code)
```

###  Alternatives

[alexandernst/yii2-device-detect

Yii2 extension for Mobile-Detect library

135865.7k3](/packages/alexandernst-yii2-device-detect)[tobimori/kirby-seo

The default choice for SEO on Kirby: Implement technical SEO &amp; Meta best practices with ease and provide an easy-to-use editor experience

10744.5k1](/packages/tobimori-kirby-seo)[amranidev/laracombee

Recommendation system for laravel

11537.9k1](/packages/amranidev-laracombee)

PHPackages © 2026

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