2017 © Pedro Peláez
 

library country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

image

woutersioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  • Wednesday, October 14, 2015
  • by WouterSioen
  • Repository
  • 1 Watchers
  • 4 Stars
  • 2,218 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

Build Status, (*1)

Abandoned

You can do the same things as with this package using the symfony/intl component https://symfony.com/doc/master/components/intl.html#country-names, (*2)

Country list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language., (*3)

Installing

composer.json, (*4)

{
    "require": {
        "woutersioen/country-list": "dev-master"
    }
}

index file for your project, (*5)

// update this to the path to the "vendor/" directory, relative to this file
require_once '../vendor/autoload.php';

Usage

With dependency injection container:

First add an instance of the class Sioen\Countries to your dependency injection container., (*6)

// fetch an array of countries in a language
$languages = $this->getContainer()->get('countries')->getForLanguage('en');

// fetch one country in a language
$language = $this->getContainer()->get('countries')->getSpecificForLanguage('be', 'en');
// returns 'Belgium'

Most modern PHP Frameworks have a dependency injection container. This is the prefered way, since there will only be one instance of the countries object, and data will be cached in this object., (*7)

PHP 5.4 (+)

use Sioen\Countries;

// fetch an array of countries in a language
$languages = (new Countries)->getForLanguage('en');

// fetch one country in a language
$language = (new Countries)->getSpecificForLanguage('be', 'en');
// returns 'Belgium'

PHP 5.3

use Sioen\ContryList;

$countries = new Countries();

// fetch an array of countries in a language
$languages = $countries->getForLanguage('en');

// fetch one country in a language
$language = $countries->getSpecificForLanguage('be', 'en');
// returns 'Belgium'

The Versions

14/10 2015

dev-master

9999999-dev https://github.com/WouterSioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  Sources   Download

MIT

The Requires

 

countries

14/10 2015

dev-analysis-qB2Ymq

dev-analysis-qB2Ymq https://github.com/WouterSioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  Sources   Download

MIT

The Requires

 

countries

26/08 2015

1.0.1

1.0.1.0 https://github.com/WouterSioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  Sources   Download

MIT

The Requires

 

countries

11/08 2015

1.0.0

1.0.0.0 https://github.com/WouterSioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  Sources   Download

MIT

The Requires

 

countries

23/09 2014

0.1

0.1.0.0 https://github.com/WouterSioen/country-list

A wrapper around https://github.com/umpirsky/country-list to easily fetch a list of countries in a certain language or get a specific country by country code and language.

  Sources   Download

MIT

The Requires

 

countries