| Package Data | |
|---|---|
| Maintainer Username: | IftekherSunny |
| Maintainer Contact: | iftekhersunny@hotmail.com (Iftekher Sunny) |
| Package Create Date: | 2016-02-11 |
| Package Last Update: | 2017-01-10 |
| Home Page: | https://packagist.org/packages/sun/country |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-26 03:02:20 |
| Package Statistics | |
|---|---|
| Total Downloads: | 15,736 |
| Monthly Downloads: | 128 |
| Daily Downloads: | 0 |
| Total Stars: | 10 |
| Total Watchers: | 1 |
| Total Forks: | 2 |
| Total Open Issues: | 1 |
Sun Country is the package that helps you to get country name and dialing code by the country ISO 3166-1 Alpha-2 code.
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
$country = new Sun\Country;
$country->get();
$country = new Sun\Country;
$country->get('BD');
$country = new Sun\Country;
$country->get(['BD', 'US']);
$country = new Sun\Country;
$country->bd;
$country = new Sun\Country;
$country->getName('BD');
$country = new Sun\Country;
$country->getDialingCode('BD');
$country = new Sun\Country;
$country->getCountryNameByGeoIp('203.202.251.42');
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,
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,
This package is licensed under the MIT License