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

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

sun/country
===========

Sun Country is the package that helps you to get the country name &amp; dialing code by the country ISO 3166-1 Alpha-2 code.

v1.3(9y ago)1016.8k↓83.7%2[1 issues](https://github.com/IftekherSunny/Country/issues)MITPHPPHP &gt;=5.5.0

Since Feb 11Pushed 9y ago1 watchersCompare

[ Source](https://github.com/IftekherSunny/Country)[ Packagist](https://packagist.org/packages/sun/country)[ RSS](/packages/sun-country/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Sun Country
-----------

[](#sun-country)

[![Build Status](https://camo.githubusercontent.com/1ff5ab6509339d433eafa090c714aa29d595424454b7a7bb80bfe98cf600afbd/68747470733a2f2f7472617669732d63692e6f72672f496674656b68657253756e6e792f436f756e7472792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/IftekherSunny/Country) [![Total Downloads](https://camo.githubusercontent.com/6eaa7d0eb2c508778049871d0a4b9aa679cf7dee8b9e428485b4023af6fcae23/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f636f756e7472792f646f776e6c6f616473)](https://packagist.org/packages/sun/country) [![Latest Stable Version](https://camo.githubusercontent.com/2b9a08480cb2892bde42492c6b95b1d49b432a47dd80471a3c6c09610bf16c57/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f636f756e7472792f762f737461626c65)](https://packagist.org/packages/sun/country) [![Latest Unstable Version](https://camo.githubusercontent.com/b9bcea66cf4fb6fdde74f11c9d915a25ad6e37e480675efbd52ddb155d33e9bc/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f636f756e7472792f762f756e737461626c65)](https://packagist.org/packages/sun/country) [![License](https://camo.githubusercontent.com/83592e7fa21211d977d4bcbd6f48aeda6b70aeb30d5e8258dd5c614db9f9f347/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f636f756e7472792f6c6963656e7365)](https://packagist.org/packages/sun/country)

Sun Country is the package that helps you to get country name and dialing code by the country ISO 3166-1 Alpha-2 code.

Installation Process
--------------------

[](#installation-process)

Just copy Country folder somewhere into your project directory. Then include Sun Country autoload file.

```
require_once('/path/to/Country/autoload.php');
```

Sun Country is also available via Composer/Packagist.

```
composer require sun/country

```

Basic Uses
----------

[](#basic-uses)

#### Get all countries name and dialing code

[](#get-all-countries-name-and-dialing-code)

```
$country = new Sun\Country;
$country->get();
```

#### Get a country name and dialing code

[](#get-a-country-name-and-dialing-code)

```
$country = new Sun\Country;
$country->get('BD');
```

#### Get multiple countries name and dialing code

[](#get-multiple-countries-name-and-dialing-code)

```
$country = new Sun\Country;
$country->get(['BD', 'US']);
```

#### Get a country name and dialing code using Alpha 2 code as property

[](#get-a-country-name-and-dialing-code-using-alpha-2-code-as-property)

```
$country = new Sun\Country;
$country->bd;
```

#### Get a country name

[](#get-a-country-name)

```
$country = new Sun\Country;
$country->getName('BD');
```

#### Get a country dialing code

[](#get-a-country-dialing-code)

```
$country = new Sun\Country;
$country->getDialingCode('BD');
```

#### Get a country name using country geo ip address

[](#get-a-country-name-using-country-geo-ip-address)

```
$country = new Sun\Country;
$country->getCountryNameByGeoIp('203.202.251.42');
```

Integration In Laravel Framework
--------------------------------

[](#integration-in-laravel-framework)

Add the ServiceProvider to the providers array in config/app.php

```
Sun\Provider\CountryServiceProvider::class,
```

Add the facade to the aliases array in config/app.php

```
'Country'   =>  Sun\Facade\CountryFacade::class,
```

Integration In Planet Framework
-------------------------------

[](#integration-in-planet-framework)

Add the provider in the config/provider.php file.

```
Sun\Provider\CountryProvider::class,
```

Add the alien in the config/alien.php file.

```
'Country'   =>  Sun\Alien\CountryAlien::class,
```

License
-------

[](#license)

This package is licensed under the [MIT License](https://github.com/iftekhersunny/Country/blob/master/LICENSE)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

3461d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d233b865d7b1e1b86271e3bc70ddd077e1c01e4a83124e020fa39199c4af15a?d=identicon)[IftekherSunny](/maintainers/IftekherSunny)

---

Top Contributors

[![IftekherSunny](https://avatars.githubusercontent.com/u/8013399?v=4)](https://github.com/IftekherSunny "IftekherSunny (3 commits)")

---

Tags

countrycountry-codescountry-namesphplaravelsunplanetcountrycountry codeplanet country codesun country codelaravel countrylaravel country code

### Embed Badge

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

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[oat-sa/tao-core

TAO core extension

66143.7k122](/packages/oat-sa-tao-core)[amranidev/laracombee

Recommendation system for laravel

11538.8k1](/packages/amranidev-laracombee)[yieldstudio/tailwind-merge-php

Merge Tailwind CSS classes without style conflicts

4975.4k1](/packages/yieldstudio-tailwind-merge-php)

PHPackages © 2026

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