Skip to content

grizzlyware/intl-zones

Repository files navigation

Provides a list of zones for countries

Latest Version on Packagist Tests Total Downloads

This package provides a list of zones for a particular country.

Installation

You can install the package via composer:

composer require grizzlyware/intl-zones

Usage

use Grizzlyware\Intl\Zones\Zones;

$zones = Zones::forAlpha2Code('GB');

foreach ($zones as $zone) {
    echo "The name is: {$zone->name}" . PHP_EOL;
    
    if (null !== $zone->code) {
        echo "The code is: {$zone->code}" . PHP_EOL;
    } else {
        echo "No code available" . PHP_EOL;
    }
}

// Setting the locale (right now, only en is supported, and the default).
Zones::setLocale('en');

Disclaimer

The data in this package is not guaranteed to be accurate or complete.

Generating new data

There is a generator script here: bin/generate

Running this script will pull in data from Stefan Gabos' World Countries repository, which itself pulls data from Wikipedia.

Overrides are defined in resources/overrides/zones/en.php - This was created to cater for the United Kingdom, which doesn't have its counties listed in the repository above.

Testing

composer test

Contributing

Please open a PR with the additional zones and supported countries to override data.

If the data should be re-generated, please fork the repository, run the generator and open a PR.

Tests should be added where appropriate.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please do not publicly disclose any vulnerabilities - Report any vulnerabilities to [email protected] directly

Credits

License

The MIT License (MIT). Please see License File for more information.

See World Countries Repo for license of the source of the generated data.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages