PHP code example of mibo / countries
1. Go to this page and download the library: Download mibo/countries 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/ */
mibo / countries example snippets
$provider = new \MiBo\Countries\ISO\CountryProvider(
new \League\ISO3166\ISO3166($myCountryList ?? []),
new \MiBo\Currencies\ISO\ISOCurrencyProvider(
new \MiBo\Currencies\ISO\ISOArrayListLoader(),
new \Psr\Log\NullLogger()
)
)
$country = $provider->getByAlpha2('SK');
echo $country->getName(); // Slovakia
echo $country->getAlpha2(); // SK
echo $country->getAlpha3(); // SVK
echo $country->getNumericalCode(); // 703
echo $country->getCurrencies()[0]; // EUR