1. Go to this page and download the library: Download tiny-blocks/country library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tiny-blocks / country example snippets
$alpha2Code = Alpha2Code::UNITED_STATES_OF_AMERICA;
$alpha2Code->name; # UNITED_STATES_OF_AMERICA
$alpha2Code->value; # US
$alpha2Code->toAlpha3()->value; # USA
$alpha3Code = Alpha3Code::UNITED_STATES_OF_AMERICA;
$alpha3Code->name; # UNITED_STATES_OF_AMERICA
$alpha3Code->value; # USA
$alpha3Code->toAlpha2()->value; # US
$country = Country::from(alphaCode: Alpha2Code::UNITED_STATES_OF_AMERICA);
$country->name; # United States of America
$country->alpha2->value; # US
$country->alpha3->value; # USA
$country = Country::from(alphaCode: Alpha3Code::UNITED_STATES_OF_AMERICA);
$country->name; # United States of America
$country->alpha2->value; # US
$country->alpha3->value; # USA
$country = Country::from(alphaCode: Alpha3Code::UNITED_STATES_OF_AMERICA, name: 'United States');
$country->name; # United States
$country->alpha2->value; # US
$country->alpha3->value; # USA
$country = Country::fromString(alphaCode: 'US');
$country->name; # United States of America
$country->alpha2->value; # US
$country->alpha3->value; # USA
$country = Country::fromString(alphaCode: 'USA', name: 'United States');
$country->name; # United States
$country->alpha2->value; # US
$country->alpha3->value; # USA
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.