1. Go to this page and download the library: Download rovereto/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/ */
rovereto / country example snippets
use Rovereto\Country\Concerns\TimeZone;
class MyClass
{
use TimeZone;
...
}
$myClass = new MyClass();
//find time zone for Trentino-Alto Adige, Italy
//return "Europe/Rome"
$myClass->getTimeZone("IT", "IT-32");
//or
$myClass->getTimeZone("IT");
use Rovereto\Country\Concerns\TimeZone;
class MyClass
{
use TimeZone;
...
}
$myClass = new MyClass();
//find time zone for Canada
$myClass->getTimeZone("CA");
//return "America/Toronto"
use Rovereto\Country\Concerns\Continent;
class MyClass
{
use Continent;
...
}
$myClass = new MyClass();
//find continent for Italy
$myClass->getContinentByCountry("IT");
//return "Europe"
//find continent code for Italy
$myClass->getContinentCodeByCountry("IT");
//return "EU"
//find continent by continent code
$myClass->getContinentByCode("SA");
//return "South America"
use Rovereto\Country\Concerns\Continent;
class MyClass
{
use Continent;
...
}
$myClass = new MyClass();
//find continent for Russia
$myClass->getContinentCodeByCountry("RU");
//return "EU"
//find continent for Moscow, Russia
$myClass->getContinentByCountry("RU", "RU-MOW");
//return "Europe"
//find continent for Novosibirskaya oblast', Russia
$myClass->getContinentByCountry("RU", "RU-NVS");
//return "Asia"
//find continent code for Moscow, Russia
$myClass->getContinentCodeByCountry("RU", "RU-MOW");
//return "EU"
//find continent code for Novosibirskaya oblast', Russia
$myClass->getContinentCodeByCountry("RU", "RU-NVS");
//return "AS"
use Rovereto\Country\Concerns\Subdivision;
class MyClass
{
use Subdivision;
...
}
$myClass = new MyClass();
//find subdivision code for Trentino-Alto Adige, Italy
$myClass->getSubdivisionCode("IT", "Trentino-Alto Adige");
//return "IT-32"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.