2017 © Pedro Peláez
 

library country-converter

A PHP package to convert a country ISO to country name and vice-versa.

image

chibifr/country-converter

A PHP package to convert a country ISO to country name and vice-versa.

  • Tuesday, December 8, 2015
  • by ChibiFR
  • Repository
  • 1 Watchers
  • 1 Stars
  • 64 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Country Converter

A PHP package to convert a country ISO to country name and vice-versa., (*1)

Installation

To install this package, make sure you have composer. Then, require it:, (*2)

composer require chibifr/country-converter

Usage

You can now use it really easily! After you required the package with composer, start using it:, (*3)

Without Exception management, (*4)

<?php
// Require the composer's vendor autoload file
require './vendor/autoload.php';

use ChibiFR\CountryConverter\Converter;

// Create a new Converter object
$converter = new Converter();

// Get a country name from its ISO code
echo $converter->getCountryName('jp'); // will echo "Japan"

// Get a country ISO code from its name
echo $converter->getCountryCode('France'); // will echo "FR"

With Exception management, (*5)

<?php
// Require the composer's vendor autoload file
require './vendor/autoload.php';

use ChibiFR\CountryConverter\Converter;

// Create a new Converter object
$converter = new Converter();

// Get a country name from its ISO code
try {
    echo $converter->getCountryName('jp'); // will echo "Japan"
} catch (InvalidCountryNameException $e) {
    die($e->getMessage());
}

// Get a country ISO code from its name
try {
    echo $converter->getCountryCode('France'); // will echo "FR"
} catch (InvalidCountryCodeException $e) {
    die($e->getMessage());
}

The Versions

08/12 2015

dev-master

9999999-dev

A PHP package to convert a country ISO to country name and vice-versa.

  Sources   Download

MIT

The Development Requires

by Simon Auber

15/11 2015

1.0.0

1.0.0.0

A PHP package to convert a country ISO to country name and vice-versa.

  Sources   Download

MIT

The Development Requires

by Simon Auber