2017 © Pedro Peláez
 

library isocodes-country

image

zend-modules/isocodes-country

  • Wednesday, October 28, 2015
  • by JPG-Consulting
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

isocodes-country

Build Status, (*1)

Installation

  1. Add this project in your composer.json:, (*2)

    "require": {
        "zend-modules/isocodes-country": "dev-master"
    }
    
  2. Now tell composer to download isocodes-country by running the command:, (*3)

    $ php composer.phar update
    

Adapters

StaticAdapter

The static adapter uses an internal array of country names. This is the default adapter as no extra configuration in needed., (*4)

$countryManager = new \IsoCodes\Country\Country();

Pdo

This adapter uses a PDO connection to fetch the data from a database. You have a MySQL dump of the database table in data\iso_3166.sql, (*5)

$dbh = new \Pdo('mysql:host:localhost;dbname=isodata;', 'root', '');
$adapter = new \IsoCodes\Country\Adapter\Pdo($dbh);
$countryManager = new \IsoCodes\Country\Country($adapter);

You may also pass the PDO::__construct parameters., (*6)

$adapter = new \IsoCodes\Country\Adapter\Pdo(array(
    'dsn'      => 'mysql:host:localhost;dbname=isodata;',
    'username' => 'root',
    'password' => ''
));
$countryManager = new \IsoCodes\Country\Country($adapter);

ZendDB

This adapter uses a Zend\Db\Adapter\Adapterinterface object to retrieve country information from a database., (*7)

As an example:, (*8)

$dbAdapter      = $serviceManager->get('Zend\Db\Adapter\Adapter');
$adapter        = new \IsoCodes\Country\Adapter\ZendDB($dbAdapter);
$countryManager = new \IsoCodes\Country\Country($adapter);

Translating

The default output is english., (*9)

To change the output locale set the translator's locale to the one that fits your needs. For example, if you wish to output the country names in spanish:, (*10)

$countryManager->getTranslator()->setLocale('es');

Data Source

The data provided by this module comes from iso-codes package from Debian., (*11)

http://pkg-isocodes.alioth.debian.org/, (*12)

The Versions

28/10 2015

dev-master

9999999-dev

  Sources   Download

GPLv3

The Requires

 

The Development Requires