Skip to content
Branch: master
Clone or download
Latest commit ca55c04 Aug 25, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources added numeric resource & country value object Aug 18, 2018
src Added factory Aug 20, 2018
tests Added factory Aug 20, 2018
.gitignore
.travis.yml Added travis file & added info to README Aug 20, 2018
LICENSE Initial commit Aug 16, 2018
README.md
composer.json Added travis file & added info to README Aug 20, 2018
phpunit.xml

README.md

PHP ISO-3166-1 library

A PHP library providing ISO 3166-1 data.

Build Status codecov License

Installing

$ composer require zhuravel/php-iso-3166-1

Example #1

<?php
require 'vendor/autoload.php';

$canada1 = getTwoCharacterCountries()['CA'];
$canada2 = getThreeCharacterCountries()['CAN'];
$canada3 = getNumericCountryCodes()['124'];

var_dump($canada1, $canada2, $canada3);

Example #2

<?php
require 'vendor/autoload.php';

foreach (getTwoCharacterCountries() as $code => $name) {
    echo sprintf("%s %s\n", $code, $name);
}

Example #3

<?php
require 'vendor/autoload.php';

use Iso\Countries\Factory\ISO3166CountryFactory;

$factory = new ISO3166CountryFactory();

$canada = $factory->fromAlphaTwoCode('CA');

var_dump($canada);

Source(s)

You can’t perform that action at this time.