PHPackages                             cromwell/iso3166 - 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. cromwell/iso3166

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

cromwell/iso3166
================

A simple package for working with ISO-3166 country codes

1.0(10y ago)065.2k[1 PRs](https://github.com/bencromwell/iso3166/pulls)PHPPHP &gt;=5.4.0CI passing

Since Oct 10Pushed 3mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (2)Versions (7)Used By (0)

iso3166
=======

[](#iso3166)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1e200d91113601066d43332a83446c21fea0188d8772c826fa31ffa78ebf403d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e63726f6d77656c6c2f69736f333136362f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bencromwell/iso3166/?branch=master)[![Build Status](https://camo.githubusercontent.com/f0c335ef52daab522892e4eea0f232b18edd2ed37e60f8d2186e8247616c4dbf/68747470733a2f2f7472617669732d63692e6f72672f62656e63726f6d77656c6c2f69736f333136362e737667)](https://travis-ci.org/bencromwell/iso3166)[![Code Climate](https://camo.githubusercontent.com/9c1e033c7a87c0aa658149a7831163d1bd2be6c1383ba84953a3ca530debf82b/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f62656e63726f6d77656c6c2f69736f333136362f6261646765732f6770612e737667)](https://codeclimate.com/github/bencromwell/iso3166)[![Test Coverage](https://camo.githubusercontent.com/863367904b7d662103edaf138655cb94aefbf9d344161cb21595e6460f7d6509/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f62656e63726f6d77656c6c2f69736f333136362f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/bencromwell/iso3166/coverage)

Package for interacting with ISO3166 country codes

### Example Usage

[](#example-usage)

```
$iso = new \Cromwell\ISO3166\Countries();

$iso[$iso::UNITED_KINGDOM]->name;
```

The above isn't *hugely* useful, it gets more interesting when the code has been stored and retrieved from persistence:

```
$iso = new \Cromwell\ISO3166\Countries();

$iso[$customer->country]->name;
```

You can also use `jsonSerialize()` either for JSON encoding or as a convenient way to get a multidimensional array for use to construct a `` box of code =&gt; name.

### Subsets

[](#subsets)

You can construct any subset of countries by passing an array of codes. The package contains an EU subset at the moment, you can use the EU class as an example of how to do it or if you just wanted EU countries, there you go.

Passing an array of codes is useful if they've been selected on the fly by an end user. It could be a list of countries that they ship to, for example. In this instance it's likely to change between customers or be initialised from the database. If it's a static list, such as a continent or EU membership, use the EU example and extend the base Countries class to implement your subset.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance53

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Total

4

Last Release

3670d ago

Major Versions

0.2 → 1.02016-04-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9c29b364fc8b9934fb124303aaba7c7be7273c165954069b0af07b42b5781a2?d=identicon)[ben.cromwell](/maintainers/ben.cromwell)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cromwell-iso3166/health.svg)

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

###  Alternatives

[wartron/yii2-uuid

Yii2 UUID Helpers

124.8k](/packages/wartron-yii2-uuid)

PHPackages © 2026

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