2017 © Pedro Peláez
 

library iso3166

A simple package for working with ISO-3166 country codes

image

cromwell/iso3166

A simple package for working with ISO-3166 country codes

  • Saturday, April 30, 2016
  • by ben.cromwell
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6,001 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

iso3166

Scrutinizer Code Quality Build Status Code Climate Test Coverage, (*1)

Package for interacting with ISO3166 country codes, (*2)

Example Usage

$iso = new \Cromwell\ISO3166\Countries();

$iso[$iso::UNITED_KINGDOM]->name;

The above isn't hugely useful, it gets more interesting when the code has been stored and retrieved from persistence:, (*3)

$iso = new \Cromwell\ISO3166\Countries();

$iso[$customer->country]->name;

You can also use jsonSerialize() either for JSON encoding or as a convenient way to get a multidimensional array for use to construct a <select> box of code => name., (*4)

Subsets

You can construct any subset of countries by passing an array of codes. The package contains an EU subset at the moment, you can use the EU class as an example of how to do it or if you just wanted EU countries, there you go., (*5)

Passing an array of codes is useful if they've been selected on the fly by an end user. It could be a list of countries that they ship to, for example. In this instance it's likely to change between customers or be initialised from the database. If it's a static list, such as a continent or EU membership, use the EU example and extend the base Countries class to implement your subset., (*6)

The Versions

30/04 2016

dev-master

9999999-dev

A simple package for working with ISO-3166 country codes

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

30/04 2016

1.0

1.0.0.0

A simple package for working with ISO-3166 country codes

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

10/10 2015

0.2

0.2.0.0

A simple package for working with ISO-3166 country codes

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

10/10 2015

0.0.2

0.0.2.0

A simple package for working with ISO-3166 country codes

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

10/10 2015

0.1

0.1.0.0

A simple package for working with ISO-3166 country codes

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires