zhuravel/php-iso-3166-1

ISO 3166-1 PHP library

0.0.1 2018-08-20 08:53 UTC

README

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)