项目作者: IftekherSunny

项目描述 :
Sun Country is the package that helps you to get country name and dialing code by the country ISO 3166-1 Alpha-2 code.
高级语言: PHP
项目地址: git://github.com/IftekherSunny/Country.git
创建时间: 2016-02-11T04:06:52Z
项目社区:https://github.com/IftekherSunny/Country

开源协议:MIT License

下载


Sun Country

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

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.

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

Sun Country is also available via Composer/Packagist.

  1. composer require sun/country

Basic Uses

Get all countries name and dialing code

  1. $country = new Sun\Country;
  2. $country->get();

Get a country name and dialing code

  1. $country = new Sun\Country;
  2. $country->get('BD');

Get multiple countries name and dialing code

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

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

  1. $country = new Sun\Country;
  2. $country->bd;

Get a country name

  1. $country = new Sun\Country;
  2. $country->getName('BD');

Get a country dialing code

  1. $country = new Sun\Country;
  2. $country->getDialingCode('BD');

Get a country name using country geo ip address

  1. $country = new Sun\Country;
  2. $country->getCountryNameByGeoIp('203.202.251.42');

Integration In Laravel Framework

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

  1. Sun\Provider\CountryServiceProvider::class,

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

  1. 'Country' => Sun\Facade\CountryFacade::class,

Integration In Planet Framework

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

  1. Sun\Provider\CountryProvider::class,

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

  1. 'Country' => Sun\Alien\CountryAlien::class,

License

This package is licensed under the MIT License