PHPackages                             writecrow/country\_code\_converter - 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. writecrow/country\_code\_converter

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

writecrow/country\_code\_converter
==================================

Convert country name to codes or vice-versa.

1.3.0(7mo ago)696.4k—1.2%51MITPHPCI failing

Since Oct 20Pushed 7mo ago4 watchersCompare

[ Source](https://github.com/writecrow/country_code_converter)[ Packagist](https://packagist.org/packages/writecrow/country_code_converter)[ RSS](/packages/writecrow-country-code-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (1)

Country Code Converter
======================

[](#country-code-converter)

[![Circle CI](https://camo.githubusercontent.com/6332fc9e79cc91536116168a1330510ec39e8ff78829205fb13e28180e57a8e6/68747470733a2f2f636972636c6563692e636f6d2f67682f777269746563726f772f636f756e7472795f636f64655f636f6e7665727465722e7376673f7374796c653d736869656c64)](https://circleci.com/gh/writecrow/country_code_converter)

A PHP library for converting ISO country codes to names and vice-versa.

Country data was last updated on August 10, 2017, from [https://en.wikipedia.org/wiki/ISO\_3166-1#Officially\_assigned\_code\_elements](https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements)

The library recognizes ISO 2-digit, 3-digit, and numeric codes.

Usage in an application
-----------------------

[](#usage-in-an-application)

The included `/demo/index.php` file contains a generation form demo.

Make your code aware of the CountryCodeConverter class via your favorite method (e.g., `use` or `require`)

Then pass a country code or country name into the class:

```
echo CountryCodeConverter::convert('AL');
// Will print 'Albania'

echo CountryCodeConverter::convert('ALB');
// Will print 'Albania'

echo CountryCodeConverter::convert('008');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania');
// Will print 'AL'
```

### Explicitly requesting return format.

[](#explicitly-requesting-return-format)

If you want a specific format returned, pass the desired format as a second parameter:

```
echo CountryCodeConverter::convert('Albania', 'name');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania', 'two-digit');
// Will print 'AL'

echo CountryCodeConverter::convert('Albania', 'three-digit');
// Will print 'ALB'

echo CountryCodeConverter::convert('Albania', 'numeric');
// Will print '008'
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance65

Regular maintenance activity

Popularity38

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 92% 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 ~730 days

Total

4

Last Release

210d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27739911?v=4)[Corpus &amp; Repository of Writing (Crow)](/maintainers/writecrow)[@writecrow](https://github.com/writecrow)

---

Top Contributors

[![markfullmer](https://avatars.githubusercontent.com/u/4305692?v=4)](https://github.com/markfullmer "markfullmer (23 commits)")[![jmf3658](https://avatars.githubusercontent.com/u/34824280?v=4)](https://github.com/jmf3658 "jmf3658 (1 commits)")[![vitaliy-gituser](https://avatars.githubusercontent.com/u/73833107?v=4)](https://github.com/vitaliy-gituser "vitaliy-gituser (1 commits)")

---

Tags

php-library

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[caffeinated/menus

Laravel Menus

134159.5k5](/packages/caffeinated-menus)

PHPackages © 2026

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