PHP code example of suilven / ukpostcodes
1. Go to this page and download the library: Download suilven/ukpostcodes library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
suilven / ukpostcodes example snippets
$postcode = PostCodeFactory::get('KY16 9SS');
$api = new Suilven\UKPostCodes\API();
$lookup = $this->api->lookup('KY16 9SS'');
$postcode = PostCodeFactory::get('KY16 9SS');
$nearby = $postcode->nearest();
$api = new Suilven\UKPostCodes\API();
$nearest = $this->api->nearest('SW1A 2AA');
$api = new Suilven\UKPostCodes\API();
$postcodeObjects = $this->api->bulkLookup([
'SW1A 2AA',
'KY16 9SS',
'KY11 3ED'
]);
$api = new Suilven\UKPostCodes\API();
$coors = [
[
'latitude' => 51.50354,
'longitude' => -0.127695,
],
[
'latitude' => 56.340349,
'longitude' => -2.808787,
],
[
'latitude' => 56.03587,
'longitude' => -3.500364,
],
];
$bulkReversed = $this->api->bulkReverseGeocoding($coors);
$api = new Suilven\UKPostCodes\API();
$postcodeObjects = $this->api->nearestPostcodesFromLongLat(0.629834723775309, 51.7923246977375);
$api = new Suilven\UKPostCodes\API();
$terminated = $this->api->lookupTerminated('AB1 0AA');
$api = new Suilven\UKPostCodes\API();
$lookup = $this->api->lookupOutwardCode('RH1');
$api = new Suilven\UKPostCodes\API();
$lookup = $this->api->nearestOutwardCodeFromLongLat(0.629834723775309, 51.7923246977375);
$api = new Suilven\UKPostCodes\API();
$nearest = $this->api->nearestOutwardCode('RH1');
$api = new Suilven\UKPostCodes\API();
$autocompletedPostCodes = $this->api->partial('SW16');
$api = new Suilven\UKPostCodes\API();
$postcodeObjs = $this->api->query('SW16');
$api = new Suilven\UKPostCodes\API();
$random = $this->api->random();
$api = new Suilven\UKPostCodes\API();
$distance = $this->api->distance('SW1A 2AB', 'EH99 1SP', Distance::KM);
$api = new Suilven\UKPostCodes\API();
// false as there is no space in the postcode
$validated = $this->api->validate('KYAB92A');