PHPackages                             ericlagarda/multilingual-country-list-php5-5 - 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. ericlagarda/multilingual-country-list-php5-5

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

ericlagarda/multilingual-country-list-php5-5
============================================

Lookup Objects for ISO 3166 Country Names and Codes

1.2.0(10y ago)032MITPHPPHP &gt;=5.6.0

Since Apr 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Krato/Multilingual-Country-List-php5-5)[ Packagist](https://packagist.org/packages/ericlagarda/multilingual-country-list-php5-5)[ Docs](https://github.com/petercoles/multilingualcountry-list)[ RSS](/packages/ericlagarda-multilingual-country-list-php5-5/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (4)Used By (0)

Multilingual Country Lists for Laravel 5
========================================

[](#multilingual-country-lists-for-laravel-5)

For PHP &lt; 5.5.9
==================

[](#for-php--559)

[![SensioLabsInsight](https://camo.githubusercontent.com/79ad59d24c0daf6a3b05d27932f9cecef892b2f0cc505b7123cddffe2a273cb5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31383239323436372d323534372d343631612d383962632d6330663737613162653238362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/18292467-2547-461a-89bc-c0f77a1be286)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/990fcb52d20ff326389ee04746eef8de36ea90316a1dd3a76e17af8e7cd291aa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7065746572636f6c65732f4d756c74696c696e6775616c2d436f756e7472792d4c6973742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/petercoles/Multilingual-Country-List/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/e521effd6ab53f6481a05dc436ca7194d52c5bc1a034715bb62076b014e1b972/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7065746572636f6c65732f4d756c74696c696e6775616c2d436f756e7472792d4c6973742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/petercoles/Multilingual-Country-List/?branch=master)[![Build Status](https://camo.githubusercontent.com/576ac57ad0f3cf7440772311d1a9aa6a0425bb33e2a049c80bc37ddb36d5259b/68747470733a2f2f7472617669732d63692e6f72672f7065746572636f6c65732f4d756c74696c696e6775616c2d436f756e7472792d4c6973742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/petercoles/Multilingual-Country-List)[![License](https://camo.githubusercontent.com/e498eead712d82d9ee1af0a4850acd2e46ea48c48fb9ce5a3d2ab64f28f95b34/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](http://doge.mit-license.org)

Is the same code I fork from petercoles but changed to use it with PHP &lt; 5.5.9

Introduction
------------

[](#introduction)

I've lost count of the number of time that I've carefully edited a list of 250 of so countries to create the data needed for a select field on a form - and that's just for one language. This thin Laravel wrapper around an industry-maintained list of country names in many, many languages, consigns that tedious task and ongoing maintenance of those lists to the trash bin of history.

The package provides easy access, through a simple API, to country names in an enormously large number of language and locale settings, together with their ISO-3166 alpha-2 two-letter country codes.

Data can be returned as a lookup array or an array of key-value pairs, where both the key and value labels can be set according to the needs of the software consuming them.

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

[](#installation)

At the command line run

```
composer require ericlagarda/multilingual-country-list-php5-5

```

then add the service provider to the providers entry in your config/app.php file

```
    'providers' => [
        // ...
        PeterColes\Countries\CountriesServiceProvider::class,
        // ...
    ],

```

An optional facade is also available and can be enabled by adding the following to you config/app.php's aliases array

```
'Countries' => PeterColes\Countries\CountriesFacade::class,

```

Usage
-----

[](#usage)

Once installed the package exposes two API methods: lookup() and keyValue(), each of which returns a list of countries ordered by the country name in the language being used.

### Lookup

[](#lookup)

The `lookup` method takes two optional parameters: $locale (default 'en') and $flip (default false) and returns a collection. This collection will be cast to a json object by Laravel if returned as a response, or can be cast to an array if needed with the toArray() method.

Locales can be expressed as a language code, e.g. 'fr', or a full locale code, e.g. zh\_CN.

#### Examples

[](#examples)

The default is English.

```
Countries::lookup();

// returns

{
  "AF": "Afghanistan",
  ...
  "ZW": "Zimbabwe"
}

```

The flip parameter facilitates reverse lookups, e.g. for typahead components that recognize values, but don't support keys, requiring the key to obtained later.

```
Countries::lookup('es', true);

// returns

{
  "Afganistán": "AF",
  ...
  "Zimbabue": "ZW"
}

```

Non-latin character sets are supported too, including locale settings

```
Countries::lookup('zh_CN');

// returns

{
  "AL": "阿尔巴尼亚",
  ...
  "HK": "中国香港特别行政区"
}

```

### keyValue

[](#keyvalue)

The `keyValue` method takes three optional parameters: $locale (default 'en'), $key (default 'key') and $value (default 'value').

#### Examples

[](#examples-1)

The default is still English.

```
Countries::keyValue();

// returns

[
  {"key": "AF", "value": "Afghanistan"},
  ...
  {"key": "ZW", "value": "Zimbabwe"}
]

```

If you need a key-value list with custom indices, then the $key and $value parameters can be used to redfine them. this might be the case, for example, if you're using a javascript component to generate a select field and that component has expectations as to the indices used in the data that it receoves.

```
Countries::keyValue('zh', 'label', 'text');

// returns

[
  {"label": "AL", "text": "阿尔巴尼亚"},
  ...
  {"label": "HK", "text": "中国香港特别行政区"}
]

```

Issues
------

[](#issues)

This package was developed to meet a specific need and then generalised for wider use. If you have a use case not currently met, or see something that appears to not be working correctly, please raise an issue at the [github repo](https://github.com/petercoles/countries/issues)

License
-------

[](#license)

This package is licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 81.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

Every ~6 days

Total

3

Last Release

3707d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3865030b01e29299f1f6837852ba6a70fea204ceb46e58a917d4e4398268800f?d=identicon)[Krato1](/maintainers/Krato1)

---

Top Contributors

[![petercoles](https://avatars.githubusercontent.com/u/2947594?v=4)](https://github.com/petercoles "petercoles (26 commits)")[![Krato](https://avatars.githubusercontent.com/u/74367?v=4)](https://github.com/Krato "Krato (6 commits)")

---

Tags

laravelISO 3166country codescountry listscountry lookup

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ericlagarda-multilingual-country-list-php5-5/health.svg)

```
[![Health](https://phpackages.com/badges/ericlagarda-multilingual-country-list-php5-5/health.svg)](https://phpackages.com/packages/ericlagarda-multilingual-country-list-php5-5)
```

###  Alternatives

[petercoles/multilingual-country-list

Lookup Objects for ISO 3166 Country Names and Codes

148389.4k5](/packages/petercoles-multilingual-country-list)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90128.1k](/packages/emargareten-inertia-modal)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3614.9k](/packages/linkxtr-laravel-qrcode)

PHPackages © 2026

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