New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adamb/uk-counties

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adamb/uk-counties

A PHP list of UK counties

Source
Packagist
Version
v1.0.1
Version published
Total downloads
2.7K
Maintainers
1
Created
Source

Build Status Scrutinizer Quality Score Minimum PHP Version Scrutinizer Coverage

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()); // Returns array of counties e.g. array(1 => 'Bedfordshire', 2 => 'Berkshire', 3 => 'Bristol', etc, etc, etc)

// To list the counties in alphabetical order you can use getCountiesByName() instead of getCounties()
print_r(Counties::getCountiesByName()); // Returns same as above but in alphabetical order

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')); // Returns 46

echo(Counties::getCountyID('Aberdeenshire')); // Returns 60

Get County Name By ID

<?php

use UKCounties\Counties;

echo(Counties::getCountyName(46)); // Returns "West Yorkshire"

echo(Counties::getCountyName(60)); // Returns "Aberdeenshire"

FAQs

Package last updated on 01 Mar 2018

Related posts