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

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

delboy1978uk/country
====================

A PHP library of countries and flags.

v2.6.0(6mo ago)03.3k1[1 issues](https://github.com/delboy1978uk/country/issues)2MITPHPPHP ^8.2CI passing

Since Oct 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/delboy1978uk/country)[ Packagist](https://packagist.org/packages/delboy1978uk/country)[ RSS](/packages/delboy1978uk-country/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (21)Used By (2)

country
=======

[](#country)

[![Latest Stable Version](https://camo.githubusercontent.com/cec7b138b0b8debd850988ef49d8a226ab0592ab3d6bb8809e606abb7957a66f/68747470733a2f2f706f7365722e707567782e6f72672f64656c626f7931393738756b2f636f756e7472792f762f737461626c65)](https://packagist.org/packages/delboy1978uk/country) [![Total Downloads](https://camo.githubusercontent.com/4c212434981a1f5155d4b5978c7adc2e42cdf66eeb5646b3123d4c644e57445a/68747470733a2f2f706f7365722e707567782e6f72672f64656c626f7931393738756b2f636f756e7472792f646f776e6c6f616473)](https://packagist.org/packages/delboy1978uk/country) [![Latest Unstable Version](https://camo.githubusercontent.com/beac105b2682acafa838de69365e54d40dcaa6b0728e811fc3abdfcfcd4cf44b/68747470733a2f2f706f7365722e707567782e6f72672f64656c626f7931393738756b2f636f756e7472792f762f756e737461626c65)](https://packagist.org/packages/delboy1978uk/country) [![License](https://camo.githubusercontent.com/21d94bda3c7a8875ca0f935f3b808044b88d7f922e89bb0506707c32c1c08896/68747470733a2f2f706f7365722e707567782e6f72672f64656c626f7931393738756b2f636f756e7472792f6c6963656e7365)](https://packagist.org/packages/delboy1978uk/country)
[![build status](https://github.com/delboy1978uk/country/actions/workflows/master.yml/badge.svg)](https://github.com/delboy1978uk/country/actions/workflows/master.yml/badge.svg) [![Code Coverage](https://camo.githubusercontent.com/885cb3cc5e13630eabd63822a2a322cecf74996be21b7170c72259bb1e72aa71/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656c626f7931393738756b2f636f756e7472792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/delboy1978uk/country/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/ebbcae8b22b08f3239614bdb57753c4167fbd92b2e96f719c7347174071ac5c1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656c626f7931393738756b2f636f756e7472792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/delboy1978uk/country/?branch=master)
A countries and flags library in PHP.

installation
------------

[](#installation)

Install via composer into your project:

```
composer require delboy1978uk/country

```

usage
-----

[](#usage)

#### factory

[](#factory)

You can call `CountryFactory::generate($code)` to create a country object

```
public static function generate(string $id): Country;
```

#### entity

[](#entity)

```
public function __toString();
public function getFlag(): string;
public function getId(): string;
public function getIso(): string;
public function getName(): string;
public function getNumCode(): int;
public function setFlag(string $flag): void;
public function setId(string $id): void
public function setIso(string $iso): void;
public function setName(string $name): void;
public function setNumCode(int $numCode): void;
public function toArray(): array;
```

#### trait

[](#trait)

You can `use HasCountryTrait` to add a country to your object (also works with doctrine)

```
public function getCountry(): Country;
public function setCountry(Country $country): void;
```

#### flag image helper

[](#flag-image-helper)

You can call `Flag::render($country, $size)`, where size can be one of `tiny, small, medium, or large`.

```
 public static function render(Country $country, $size)
```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance67

Regular maintenance activity

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

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

Recently: every ~28 days

Total

20

Last Release

192d ago

Major Versions

v1.0.4 → v2.0.02019-10-29

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[symfony/polyfill-php82

Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions

6651.6M102](/packages/symfony-polyfill-php82)[ddoe/wysiwyg-editor-module

Summernote WYSIWYG Editor for OXID eShop.

191.0M5](/packages/ddoe-wysiwyg-editor-module)[tcb13/substringy

A sub string manipulation library with multibyte support that extends Stringy

1761.0k1](/packages/tcb13-substringy)

PHPackages © 2026

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