PHPackages                             sameer-shelavale/php-countries-array - 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. sameer-shelavale/php-countries-array

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

sameer-shelavale/php-countries-array
====================================

PHP class to get array of countries names with ISO\_3166-1 alpha-2, alpha-3, numeric codes, ISD codes and continent

v1.0.5(7y ago)34429.7k↓16.7%21[1 PRs](https://github.com/sameer-shelavale/php-countries-array/pulls)1AGPL-3.0-or-laterPHPPHP &gt;=5.3.0

Since Dec 16Pushed 1y ago3 watchersCompare

[ Source](https://github.com/sameer-shelavale/php-countries-array)[ Packagist](https://packagist.org/packages/sameer-shelavale/php-countries-array)[ RSS](/packages/sameer-shelavale-php-countries-array/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)DependenciesVersions (6)Used By (1)

php-countries-array
===================

[](#php-countries-array)

PHP class to get array of countries with ISO\_3166-1, ISO\_3166-2 and ISD codes it can provide following information related to the country

1. name - Name of the country
2. alpha2 - alpha2 code, 2 characters (ISO-3166-1 alpha2)
3. alpha3 - alpha3 code, 3 characters (ISO-3166-1 alpha3)
4. num - numeric code (ISO-3166-1 numeric)
5. isd - ISD code for country
6. continent - Name of the continent in which the country is present

\##Installation

#### PHP Include

[](#php-include)

Include CountryArray.php in your php code and you its ready to use.

#### Composer:

[](#composer)

Add the package to your composer.json and run composer update.

```
{
    "require": {
        "sameer-shelavale/php-countries-array": "*"
    }
}

```

\##Usage

Get simple key-value array by default it returns alpha2 =&gt; name pairs

```
$countries = CountriesArray::get();

```

Include non iso countries:

```
$countries = CountriesArray::iso(false)->get();

```

Get key values pairs

```
$countries = CountriesArray::get( 'alpha2', 'name' ); // returns alpha2->name array
$countries = CountriesArray::get( 'num', 'alpha3' ); // return numeric-codes->alpha3 array
$countries = CountriesArray::get( 'num', 'name' ); // return numeric-codes->name array

```

Get only values without keys

```
$countries = CountriesArray::get( null, 'name' ); // return array of country names
$countries = CountriesArray::get( null, 'alpha2' ); // return array of alpha2 codes

```

Get 2d array

```
$countries = CountriesArray::get2d( null, 'name' ); // return array of country names
$countries = CountriesArray::get2d( null, 'alpha2' ); // return array of alpha2 codes

```

Get countries filtered by continent

```
$countries = CountriesArray::getFromContinent( 'alpha2', 'name', 'Africa' ); // returns alpha2->name array of countries from Africa
$countries = CountriesArray::getFromContinent( 'num', 'alpha3', 'Asia' ); // return numeric-codes->alpha3 array of countries from Asia
$countries = CountriesArray::getFromContinent( 'num', 'name', 'Europe' ); // return numeric-codes->name array of countries from Europe

```

\##IMP Note Do not use ISD code(isd) and continent as key fields, as there are multiple records for them

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~508 days

Total

4

Last Release

2692d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bddb556674e2a0cc4419dee608156a81b756b960ce90d5558a0ea2d8e4a87f2?d=identicon)[sameer-shelavale](/maintainers/sameer-shelavale)

---

Top Contributors

[![sameer-shelavale](https://avatars.githubusercontent.com/u/3716265?v=4)](https://github.com/sameer-shelavale "sameer-shelavale (18 commits)")[![alnutile](https://avatars.githubusercontent.com/u/365385?v=4)](https://github.com/alnutile "alnutile (2 commits)")[![moshthepitt](https://avatars.githubusercontent.com/u/372073?v=4)](https://github.com/moshthepitt "moshthepitt (2 commits)")[![SunflowerFuchs](https://avatars.githubusercontent.com/u/18332886?v=4)](https://github.com/SunflowerFuchs "SunflowerFuchs (1 commits)")[![terrymun](https://avatars.githubusercontent.com/u/5593067?v=4)](https://github.com/terrymun "terrymun (1 commits)")

---

Tags

continentISO 3166-1PHP countries arraycountries arrayalpha-2alpha-3ISD CodesList of countries

### Embed Badge

![Health badge](/badges/sameer-shelavale-php-countries-array/health.svg)

```
[![Health](https://phpackages.com/badges/sameer-shelavale-php-countries-array/health.svg)](https://phpackages.com/packages/sameer-shelavale-php-countries-array)
```

###  Alternatives

[stefangabos/world_countries

Constantly updated lists of world countries, territories and areas of geographical interest, with associated alpha-2, alpha-3 and numeric codes as defined by the ISO 3166-1 standard, available in multiple formats and languages, with national flags included

1.6k136.1k1](/packages/stefangabos-world-countries)[thalidzhokov/country-codes

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

13116.9k](/packages/thalidzhokov-country-codes)[annexare/countries-list

Continents &amp; countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, ISO 4217 currencies (symbols &amp; numeric codes), native name, phone. JSON, CSV and SQL.

1.3k253.6k1](/packages/annexare-countries-list)[lizhichao/one-sm

国密sm3

1891.5M8](/packages/lizhichao-one-sm)[protonemedia/laravel-task-runner

Write Shell scripts like Blade Components and run them locally or on a remote server

1335.5k1](/packages/protonemedia-laravel-task-runner)

PHPackages © 2026

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