1. Go to this page and download the library: Download mikegarde/country-codes 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/ */
$countries = new Countries();
$results = $countries->getAllCountries();
return json_encode($results);
$countries = new Countries(true);
if ($countries->isUSTerritory('PR'))
{
echo 'Yep, a US Territory';
}
if ($countries->validate('CA', $order['consignee']['countryCode']))
{
echo 'Blame Canada';
}
$stateTest = new US();
if ($stateTest->isCONUS($order['consignee']['state']))
{
echo 'You can select USPS, UPS, or DHL';
}
else // OCONUS
{
echo 'USPS is your only option for shipping to AK, HI, APO, or an FPO address';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.