1. Go to this page and download the library: Download jabranr/postcodes-io 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/ */
jabranr / postcodes-io example snippets
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
try {
$addresses = $postcodesIO->find('NW1 5LD');
} catch(\Exception $e) {
echo $e->getMessage();
}
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO('NW1 5LD');
$addresses = $postcodesIO->getResult();
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->findByLocation(51.520331, -0.1396267);
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->findRandom();
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->random();
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->validate('NW1 5LD');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->findNearest('NW1 5LD');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->nearest();
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->autocomplete('NW1');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->query('NW1 5LD');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->search('NW1 5LD');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->findOutcode('NW1');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->nearestOutcode('NW1');
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->findOutcodeByLocation(51.520331, -0.1396267);
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->bulkPostcodeSearch(array('NW1 5LD', 'W1T 7NY'));
use Jabranr\PostcodesIO\PostcodesIO;
$postcodesIO = new PostcodesIO();
$addresses = $postcodesIO->bulkReverseGeocoding(array(
array(51.520331, -0.1396267),
array(51.520331, -0.1396267)
));