PHPackages                             rocketfellows/iso-standard-3166-factory - 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. rocketfellows/iso-standard-3166-factory

ActiveLibrary

rocketfellows/iso-standard-3166-factory
=======================================

v1.0.0(3y ago)01711MITPHPPHP &gt;=7.4

Since Jan 14Pushed 3y agoCompare

[ Source](https://github.com/rocketfellows/iso-standard-3166-factory)[ Packagist](https://packagist.org/packages/rocketfellows/iso-standard-3166-factory)[ RSS](/packages/rocketfellows-iso-standard-3166-factory/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (1)

ISO-3166 country factory
========================

[](#iso-3166-country-factory)

[![Code Coverage Badge](./badge.svg)](./badge.svg)

This component provides factory for create country according to ISO-3166 standard by:

- code (alpha2, alpha3, numeric code)
- full english name

Factory creates instance of arslanimamutdinov\\ISOStandard3166\\Country.

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

[](#installation)

```
composer require rocketfellows/iso-standard-3166-factory
```

Create Country by code
----------------------

[](#create-country-by-code)

Note: create by code case-insensitive.

Example create Country by alpha2, alpha3, numeric code:

```
$factory = new CountryFactory();

$factory->createByCode('AT');   // creates by alpha2 code
$factory->createByCode('at');   // creates by alpha2 code in lower case
$factory->createByCode('AUT');  // creates by alpha3
$factory->createByCode('aut');  // creates by alpha3 in lower case
$factory->createByCode('040');  // creates by numeric code
```

Examples above will return:

```
object(arslanimamutdinov\ISOStandard3166\Country)#3 (4) {
["name":"arslanimamutdinov\ISOStandard3166\Country":private]=>
string(7) "Austria"
["alpha2":"arslanimamutdinov\ISOStandard3166\Country":private]=>
string(2) "AT"
["alpha3":"arslanimamutdinov\ISOStandard3166\Country":private]=>
string(3) "AUT"
["numericCode":"arslanimamutdinov\ISOStandard3166\Country":private]=>
string(3) "040"
}
```

If code is empty or unknown factory will throw:

- EmptyCountryCodeException
- UnknownCountryCodeException

Create Country by english name
------------------------------

[](#create-country-by-english-name)

Note: create by code case-sensitive and need full name.

Example create Country by name:

```
$factory = new CountryFactory();

$factory->createByName('Austria');
```

Examples above will return:

```
object(arslanimamutdinov\ISOStandard3166\Country)#6 (4) {
  ["name":"arslanimamutdinov\ISOStandard3166\Country":private]=>
  string(7) "Austria"
  ["alpha2":"arslanimamutdinov\ISOStandard3166\Country":private]=>
  string(2) "AT"
  ["alpha3":"arslanimamutdinov\ISOStandard3166\Country":private]=>
  string(3) "AUT"
  ["numericCode":"arslanimamutdinov\ISOStandard3166\Country":private]=>
  string(3) "040"
}
```

If name is empty or unknown factory will throw:

- UnknownCountryNameException
- EmptyCountryNameException

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

[](#contributing)

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.3% 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

1221d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81402dcd0a07ad550b7f80f5871e7c302770b29d4c73a52fc35ba697f702d56e?d=identicon)[arslanim](/maintainers/arslanim)

---

Top Contributors

[![arslanim](https://avatars.githubusercontent.com/u/22678154?v=4)](https://github.com/arslanim "arslanim (28 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

iso-3166-1iso-3166-factoryiso-standard

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rocketfellows-iso-standard-3166-factory/health.svg)

```
[![Health](https://phpackages.com/badges/rocketfellows-iso-standard-3166-factory/health.svg)](https://phpackages.com/packages/rocketfellows-iso-standard-3166-factory)
```

PHPackages © 2026

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