zhuravel / php-iso-3166-1
ISO 3166-1 PHP library
0.0.1
2018-08-20 08:53 UTC
Requires
- php: >=5.6
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^5.7.11 || ^6.4 || ^7.0
This package is auto-updated.
Last update: 2024-12-13 03:01:55 UTC
README
A PHP library providing ISO 3166-1 data.
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)
- ISO 3166-1 by Wikipedia licensed under CC BY-SA 3.0 Unported License
- www.iso.org