PHPackages                             tigrov/yii2-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. [Localization &amp; i18n](/categories/localization)
4. /
5. tigrov/yii2-country

ActiveYii2-extension[Localization &amp; i18n](/categories/localization)

tigrov/yii2-country
===================

Country data for Yii2 using Intl extension and more.

1.1.11(6y ago)151.1k2[1 issues](https://github.com/Tigrov/yii2-country/issues)MITPHPPHP &gt;=5.5.0

Since Dec 25Pushed 6y ago3 watchersCompare

[ Source](https://github.com/Tigrov/yii2-country)[ Packagist](https://packagist.org/packages/tigrov/yii2-country)[ RSS](/packages/tigrov-yii2-country/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (15)Used By (0)

Country data for Yii2
=====================

[](#country-data-for-yii2)

The library provides access to Intl extension data for information about regions, sub-regions, countries, languages, locales, currencies and timezones. Also it has additional classes for information about continents, divisions, cities and measurement systems.

[![Latest Stable Version](https://camo.githubusercontent.com/a60fd291eac1edd2a9a75153762b12659ffa389266eeaa82c5d10a596dd46c4b/68747470733a2f2f706f7365722e707567782e6f72672f546967726f762f796969322d636f756e7472792f762f737461626c65)](https://packagist.org/packages/Tigrov/yii2-country)[![Build Status](https://camo.githubusercontent.com/15fbd38c93771684f4e0a9ec6fdf8fd5661909aa20bf613dcf3b1d0384d9347b/68747470733a2f2f7472617669732d63692e6f72672f546967726f762f796969322d636f756e7472792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Tigrov/yii2-country)

The main classes:

- Continent
- Region
- Subregion
- Country (ActiveRecord)
- Division (ActiveRecord)
- City (ActiveRecord)
- Locale
- Language
- Currency
- Timezone
- MeasurementSystem

Limitation
----------

[](#limitation)

Since 1.1.0 requires Yii &gt;= 2.0.13 and PHP &gt;= 5.5

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist tigrov/yii2-country

```

or add

```
"tigrov/yii2-country": "~1.0"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

Once the extension is installed, configure migrations in `config.php`:

```
return [
    // ...
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrationController',
        ],
    ],
    // ...
];
```

and apply migrations:

```
yii migrate

```

Usage
-----

[](#usage)

The classes have access to static methods of [Tigrov/intldata](https://github.com/Tigrov/intldata):

```
// Get list of codes.
ClassName::codes();

// Get a boolean indicating whether data has a code.
ClassName::has($code);

// Get list of names.
ClassName::names();

// Get name by code.
ClassName::name($code);

// E.g.
Country::names();
Currency::name('USD');
Locale::codes();
Timezone::has('America/New_York');
```

And some of the classes have additional static methods to get more information.

Also each of the classes has follow methods and attributes (perhaps magic):

```
// Create a model by code
ClassName::create($code);

// All models of a class
ClassName::all();

// Code of the model
$model->code;

// Name of the model
$model->name;
```

**For example:**

```
$continents = Continent::all();
$europe = Continent::create('EU');
$europe->code; // 'EU'
$europe->name; // 'Europe'

// List of countries
$europe->countries;

$us = Country::create('US');
$us->code; // 'US'
$us->name; // 'United States' (depends of the current locale)

// List of divisions (states)
$us->divisions;

// List of cities
$us->cities;
```

Addition
--------

[](#addition)

- For additional information about countries (flags, codes, borders and other) use a library
    `$country->rinvex`
    or
- For more information about Intl extension data see

    [http://intl.rmcreative.ru/tables?locale=en\_US](http://intl.rmcreative.ru/tables?locale=en_US)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 95.5% 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 ~44 days

Recently: every ~72 days

Total

14

Last Release

2543d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2112911?v=4)[Tigros](/maintainers/Tigros)[@tigros](https://github.com/tigros)

---

Top Contributors

[![Tigrov](https://avatars.githubusercontent.com/u/8563175?v=4)](https://github.com/Tigrov "Tigrov (106 commits)")[![alladas](https://avatars.githubusercontent.com/u/11385698?v=4)](https://github.com/alladas "alladas (5 commits)")

---

Tags

citycontinentcountrycurrencydivisionintllanguagelocalemeasurement-systemsregionsubdivisionsubregiontimezoneyii2-extensionintlcurrencylocalizationinternationalizationi18nlanguagel10nyii2localecountrytime zoneregionmeasurementtimezonecontinent

### Embed Badge

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

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

###  Alternatives

[symfony/intl

Provides access to the localization data of the ICU library

2.6k213.6M1.4k](/packages/symfony-intl)[aplus/language

Aplus Framework Language Library

2391.7M15](/packages/aplus-language)[delight-im/i18n

Internationalization and localization for PHP

595.4k3](/packages/delight-im-i18n)[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

91437.9k29](/packages/tractorcow-silverstripe-fluent)[jrmajor/fluent

Fluent localization system for PHP

2818.2k7](/packages/jrmajor-fluent)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)

PHPackages © 2026

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