This package provides a list of zones for a particular country.
You can install the package via composer:
composer require grizzlyware/intl-zones
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');
The data in this package is not guaranteed to be accurate or complete.
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.
composer test
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.
Please see CHANGELOG for more information on what has changed recently.
Please do not publicly disclose any vulnerabilities - Report any vulnerabilities to [email protected] directly
The MIT License (MIT). Please see License File for more information.
See World Countries Repo for license of the source of the generated data.