PHP code example of nickurt / laravel-postcodeapi

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

    

nickurt / laravel-postcodeapi example snippets


$postCode10 = PostcodeApi::create('ZippopotamusDE')->find('07751');

$postCode11 = PostcodeApi::create('PostcodeApiComAu')->find('3066');

$postCode12 = PostcodeApi::create('GetAddressIO')->find('SW1A1AA');
$postCode13 = PostcodeApi::create('IdealPostcodes')->find('SW1A1AA');
$postCode14 = PostcodeApi::create('PostcodesIO')->find('SW1A1AA');

$postCode15 = PostcodeApi::create('Bing')->find('92270');
$postCode16 = PostcodeApi::create('Geocodio')->find('92270');
$postCode17 = PostcodeApi::create('Google')->find('92270');
$postCode18 = PostcodeApi::create('Here')->find('92270');
$postCode19 = PostcodeApi::create('LocationIQ')->find('92270');
$postCode20 = PostcodeApi::create('Mapbox')->find('92270');
$postCode21 = PostcodeApi::create('OpenCage')->find('92270');
$postCode22 = PostcodeApi::create('TomTom')->find('92270');

$postCode23 = PostcodeApi::create('AdresseDataGouv')->find('75007');
$postCode24 = PostcodeApi::create('AdresseDataGouv')->findByPostcodeAndHouseNumber('75007', '5 Avenue Anatole France');

$postCode25 = PostcodeApi::create('Pro6PP_BE')->find('1000');

$postCode26 = PostcodeApi::create('ApiPostcode')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode27 = PostcodeApi::create('NationaalGeoRegister')->find('1118CP');
$postCode28 = PostcodeApi::create('NationaalGeoRegister')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode29 = PostcodeApi::create('PostcoDe')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode30 = PostcodeApi::create('PostcodeApiNu')->find('1118CP');
$postCode31 = PostcodeApi::create('PostcodeApiNu')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode32 = PostcodeApi::create('PostcodeApiNuV3')->find('1118CP');
$postCode33 = PostcodeApi::create('PostcodeApiNuV3')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode34 = PostcodeApi::create('Pro6PP_NL')->find('1118CP');

Route::get('/{postCode}', function($postCode) {
    $postCode35 = PostcodeApi::create('PostcodeApiNu')->find($postCode);
    
    return Response::json($postCode35->toArray(), 200, [], JSON_PRETTY_PRINT);
});

php artisan vendor:publish --provider="nickurt\PostcodeApi\ServiceProvider" --tag="config"