PHP code example of mfmbarber / hackpostcodes

1. Go to this page and download the library: Download mfmbarber/hackpostcodes 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/ */

    

mfmbarber / hackpostcodes example snippets


<?hh

fmbarber\HackPostcodes\Postcodes;
use mfmbarber\HackPostcodes\CurlRequest;

$postcodes = new Postcodes(new CurlRequest());

$x = $postcodes->lookup('DT51HG');
var_dump($x);

$y = $postcodes->lookupBulk(Vector {'DT51HG', 'BH122BL'});
var_dump($y);

$z = $postcodes->getDistance('DT51HG', 'BH122BL');
var_dump($z);