CountriesInfo 1.0.2

dotnet add package CountriesInfo --version 1.0.2                
NuGet\Install-Package CountriesInfo -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CountriesInfo" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CountriesInfo --version 1.0.2                
#r "nuget: CountriesInfo, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CountriesInfo as a Cake Addin
#addin nuget:?package=CountriesInfo&version=1.0.2

// Install CountriesInfo as a Cake Tool
#tool nuget:?package=CountriesInfo&version=1.0.2                

Countries Info

A comprehensive multi-language library for accessing detailed country information. Available for multiple platforms and languages.

Available Packages

1. JavaScript/Node.js

npm version

npm install @mohaned.ghawar/countries-info

2. Python

PyPI version

pip install countries-info-mg

3. PHP

Packagist Version

composer require mohanedghawar/countries-info

4. .NET

NuGet version

dotnet add package CountriesInfo

Features

  • Comprehensive country information
  • Administrative regions for all countries
  • Detailed city data for each region including:
    • City names and populations
    • Geographical coordinates
    • Hierarchical organization (Country → Region → Cities)
  • Multiple language/platform support
  • Easy to use API
  • Consistent data structure across all platforms
  • Regular updates

Data Structure

Each country object contains:

  • Name: Country name
  • Code: ISO 3-letter code
  • Capital: Capital city
  • Continent: Continent name
  • Population: Population count
  • Area: Area in square kilometers
  • Regions: Administrative regions/divisions (states, provinces, etc.)
  • Cities: Cities within each region

City Data

Each city object contains:

  • Name: City name
  • Latitude: Geographical latitude
  • Longitude: Geographical longitude
  • Population: City population count

Usage Examples

JavaScript

const { getAllCountries, getCountryByName, getCountryByCode, getCountryRegions } = require('@mohaned.ghawar/countries-info');

// Get all countries
const countries = getAllCountries();

// Get country by name
const france = getCountryByName('France');

// Get country by code
const usa = getCountryByCode('USA');

// Get country regions
const usaRegions = getCountryRegions('USA'); // Returns all US states

Python

from countries_info import get_all_countries, get_country_by_name, get_country_by_code, get_country_regions

# Get all countries
countries = get_all_countries()

# Get country by name
france = get_country_by_name('France')

# Get country by code
usa = get_country_by_code('USA')

# Get country regions
usa_regions = get_country_regions('USA') # Returns all US states

PHP

use MohanedGhawar\CountriesInfo\CountriesInfo;

$countriesInfo = new CountriesInfo();

// Get all countries
$countries = $countriesInfo->getAllCountries();

// Get country by name
$france = $countriesInfo->getCountryByName('France');

// Get country by code
$usa = $countriesInfo->getCountryByCode('USA');

// Get country regions
$usaRegions = $countriesInfo->getCountryRegions('USA'); // Returns all US states

C# (.NET)

using CountriesInfo;

var service = new CountriesService();

// Get basic country information
var countries = service.GetAllCountries();
var usa = service.GetCountryByCode("USA");

// Get regions (states/provinces)
var regions = service.GetRegionsByCountryCode("USA"); // Returns all US states
var hasRegions = service.HasRegions("USA"); // Check if country has regions

// Get cities information
var californiaCities = service.GetCitiesByRegion("USA", "California"); // Get all cities in California
var allUsCities = service.GetAllCitiesInCountry("USA"); // Get all cities in the USA
var cityCount = service.GetCityCount("USA"); // Get total number of cities in the USA

// Example of working with city data
foreach (var city in californiaCities)
{
    Console.WriteLine($"City: {city.Name}");
    Console.WriteLine($"Population: {city.Population}");
    Console.WriteLine($"Location: {city.Latitude}, {city.Longitude}");
}

Data Coverage

  • 250+ Countries
  • 4,000+ Regions/States
  • 150,000+ Cities worldwide

Documentation

Detailed documentation for each platform:

License

MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please file an issue on the appropriate GitHub repository:

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 50 12/24/2024
1.0.1 65 12/23/2024
1.0.0 68 12/22/2024