https://github.com/iftekhersunny/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.
https://github.com/iftekhersunny/country
country country-codes country-names
Last synced: 6 months ago
JSON representation
Sun Country is the package that helps you to get country name and dialing code by the country ISO 3166-1 Alpha-2 code.
- Host: GitHub
- URL: https://github.com/iftekhersunny/country
- Owner: IftekherSunny
- License: mit
- Created: 2016-02-11T04:06:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-10T12:09:55.000Z (over 8 years ago)
- Last Synced: 2024-12-20T04:25:24.440Z (6 months ago)
- Topics: country, country-codes, country-names
- Language: PHP
- Homepage: https://packagist.org/packages/sun/country
- Size: 2.62 MB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Sun Country
[](https://travis-ci.org/IftekherSunny/Country) [](https://packagist.org/packages/sun/country) [](https://packagist.org/packages/sun/country) [](https://packagist.org/packages/sun/country) [](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
Just copy Country folder somewhere into your project directory. Then include Sun Country autoload file.
```php
require_once('/path/to/Country/autoload.php');
```Sun Country is also available via Composer/Packagist.
```
composer require sun/country
```
## Basic Uses#### Get all countries name and dialing code
```php
$country = new Sun\Country;
$country->get();
```#### Get a country name and dialing code
```php
$country = new Sun\Country;
$country->get('BD');
```#### Get multiple countries name and dialing code
```php
$country = new Sun\Country;
$country->get(['BD', 'US']);
```#### Get a country name and dialing code using Alpha 2 code as property
```php
$country = new Sun\Country;
$country->bd;
```#### Get a country name
```php
$country = new Sun\Country;
$country->getName('BD');
```#### Get a country dialing code
```php
$country = new Sun\Country;
$country->getDialingCode('BD');
```#### Get a country name using country geo ip address
```php
$country = new Sun\Country;
$country->getCountryNameByGeoIp('203.202.251.42');
```## Integration In Laravel Framework
Add the ServiceProvider to the providers array in config/app.php
```php
Sun\Provider\CountryServiceProvider::class,
```Add the facade to the aliases array in config/app.php
```php
'Country' => Sun\Facade\CountryFacade::class,
```## Integration In Planet Framework
Add the provider in the config/provider.php file.
```php
Sun\Provider\CountryProvider::class,
```Add the alien in the config/alien.php file.
```php
'Country' => Sun\Alien\CountryAlien::class,
```## License
This package is licensed under the [MIT License](https://github.com/iftekhersunny/Country/blob/master/LICENSE)