
UK Counties PHP
Produces a list of UK counties using PHP. Can be used to store county ID's rather than names.
Installation
Installation is available via Composer/Packagist, you can add the following line to your composer.json file:
"adamb/uk-counties": "^1.0"
or
composer require adamb/uk-counties
License
This software is distributed under the MIT license. Please read LICENSE for information on the
software availability and distribution.
Usage
List Counties
<?php
use UKCounties\Counties;
print_r(Counties::getCounties());
print_r(Counties::getCountiesByName());
Get County ID By Name
This can be used to store a unique county ID in a database rather than duplicating information.
<?php
use UKCounties\Counties;
echo(Counties::getCountyID('West Yorkshire'));
echo(Counties::getCountyID('Aberdeenshire'));
Get County Name By ID
<?php
use UKCounties\Counties;
echo(Counties::getCountyName(46));
echo(Counties::getCountyName(60));