1. Go to this page and download the library: Download geobase/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/ */
geobase / countries example snippets
use GeoBase\Country\CountryRepository;
$countryCollection = CountryRepository::findAll();
foreach ($countryCollection as $country) {
echo $country->getNames()->get('en');
}
$countryCollection->orderByName();
use GeoBase\Country\CountryRepository;
use GeoBase\Regions\RegionRepository;
$country = CountryRepository::findByCode('US');
$regionCollection = RegionRepository::findByCountry($country);
foreach ($regionCollection as $region) {
echo $region->getNames()->get('en') . " is a " .
$region->getType()::class . " of the " .
$country->getNames()->get('en);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.