Skip to content

CRCL/worlddata

Repository files navigation

CRCL world data

Enrich country codes with names, continent, time zone, coordinates, and TLDs.

** Warning ** this package is still in development

Use at your own risk - before we release a major version, every update can contain compatibility breaks!

Installation / Usage

Download and install this package via composer.

composer require crcl/worlddata

$oContinents = \CRCL\worlddata\World::continents(); // all continents

$oContinent = \CRCL\worlddata\World::continents()->find('EU'); // Continent instance
$oContinent->code; // EU
$oContinent->name; // Europe
$oContinent->countries(); // [CountryObj1, CountryObj2,..]

$oCountry = \crcl\worlddata\World::countries()->find('DE'); // or use shortcut ::countries('DE')
$oCountry->name; // Germany
$oCountry->coordinates; // [latitude , longitude] of country center
$oCountry->timezones; // [["Europe/Berlin", null]] Countries with multiple time-zones are represented by an array of time-zone name and time-zone longitude pairs.
$oCountry->tld; // .de
$oCountry->continent; // EU
$oCountry->continent(); // ContinentObj

// additional data sets
\crcl\worlddata\World::currencies();
\crcl\worlddata\World::languages();
\crcl\worlddata\World::topLevelDomains();

// useful samples
\crcl\worlddata\World::countries()->groupBy('continent'); // countries grouped by continents
\crcl\worlddata\World::countries()->contains('name', 'Germany') // check by any property
\crcl\worlddata\World::currencies()->exist('USD'); // check by code true
// etc..

Tip! All collections are an instance of \Illuminate\Support\Collection

Please take a look at Laravel Collections Doku for all available methods

Requirements

Tested and developed under PHP 8.0.

Security Reports

Please send any sensitive issue to support@crcl.com. Thanks!

License

This package is licensed under the MIT License - see the LICENSE file for details.

Data Accuracy

As far as we know, the data is accurate, but we make no guarantees of accuracy or completeness.

Use at your own risk.

About

Enrich country codes with names, continent, time zones, currencies, etc

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages