1. Go to this page and download the library: Download tigrov/yii2-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/ */
// Get list of codes.
ClassName::codes();
// Get a boolean indicating whether data has a code.
ClassName::has($code);
// Get list of names.
ClassName::names();
// Get name by code.
ClassName::name($code);
// E.g.
Country::names();
Currency::name('USD');
Locale::codes();
Timezone::has('America/New_York');
// Create a model by code
ClassName::create($code);
// All models of a class
ClassName::all();
// Code of the model
$model->code;
// Name of the model
$model->name;
$continents = Continent::all();
$europe = Continent::create('EU');
$europe->code; // 'EU'
$europe->name; // 'Europe'
// List of countries
$europe->countries;
$us = Country::create('US');
$us->code; // 'US'
$us->name; // 'United States' (depends of the current locale)
// List of divisions (states)
$us->divisions;
// List of cities
$us->cities;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.