Download the PHP package mhunesi/yii2-csc without Composer
On this page you can find all versions of the php package mhunesi/yii2-csc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-csc
Yii2 Country State City
Yii2 extension for Country, State, and City database with migration and Active Record models.
This extension provides comprehensive geographical data including countries, states/provinces, and cities with their related information such as ISO codes, phone codes, currencies, timezones, coordinates, and more.
Data Source
The geographical data used in this extension is sourced from the Countries States Cities Database repository, specifically from version 3.1.
This database includes:
- Countries: 250+ countries with ISO2, ISO3, phone codes, currencies, timezones, and geographical coordinates
- States: 5000+ states/provinces with country relationships and location data
- Cities: 150,000+ cities with state and country relationships
Installation
The preferred way to install this extension is through composer.
Either run:
or add to the require section of your composer.json file:
Usage
Configuration
The extension automatically registers translations via Bootstrap. If you need to manually configure translations, add this to your application config:
Supported languages:
- English (en)
- Turkish (tr)
Running Migration
After installation, configure your console application to include the migration path:
Then run the migration:
Or directly specify the migration path:
This will create three tables:
country- Countries with ISO codes, currencies, timezones, etc.state- States/provinces with country relationshipscity- Cities with state and country relationships
Models
The extension provides three Active Record models:
mhunesi\csc\models\Countrymhunesi\csc\models\Statemhunesi\csc\models\City
Usage Examples
Database Schema
Country Table
id- Primary keyname- Country nameiso2- ISO2 code (2 characters)iso3- ISO3 code (3 characters)numeric_code- Numeric country codephone_code- International phone codecapital- Capital citycurrency- Currency codecurrency_name- Currency namecurrency_symbol- Currency symboltld- Top-level domainnative- Native country nameregion- Geographic regionsubregion- Geographic subregiontimezones- Supported timezones (JSON)latitude- Geographic latitudelongitude- Geographic longitude
State Table
id- Primary keyname- State/province namecountry_id- Foreign key to countrycountry_code- Country codecountry_name- Country namestate_code- State/province codetype- Administrative typelatitude- Geographic latitudelongitude- Geographic longitude
City Table
id- Primary keyname- City namestate_id- Foreign key to statestate_code- State codestate_name- State namecountry_id- Foreign key to countrycountry_code- Country codecountry_name- Country namelatitude- Geographic latitudelongitude- Geographic longitudewikiDataId- WikiData identifier
License
Please refer to the license file for more information.