PHP code example of chadanuk / postcodes-io-laravel

1. Go to this page and download the library: Download chadanuk/postcodes-io-laravel 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/ */

    

chadanuk / postcodes-io-laravel example snippets


    'providers' => array('Chadanuk\PostcodesIo\PostcodesIoServiceProvider')
    

    'aliases' => array('PostcodesIo' => 'Chadanuk\PostcodesIo\Facade')
    

$response = $client->lookup(array('postcode' => 'CF10 1DD'));

$response = $client->bulkLookup(array('postcodes' => array('CF10 1DD', 'W1B 4BD'));

$response = $client->reverseGeocode(array('latitude' => 51.481667, 'longitude' => -3.182155);

$response = $client->bulkReverseGeocode(
    array(
        'geolocations' => array(
            array('latitude' => 51.481667, 'longitude' => -3.182155),
            array('latitude' => 51.88328, 'longitude' => -3.43684, 'limit' => 5, 'radius' => 500)
        )
    )
);

$response = $client->matching(array('query' => 'CF10', 'limit' => 20);

$response = $client->validate(array('postcode' => 'CF10 1DD');

$response = $client->autocomplete(array('postcode' => 'CF10', 'limit' => 20);

$response = $client->random();

$response = $client->outwardCodeLookup(array('outcode' => 'CF10');