Skip to content

bvweijen/laravel-postcodeapi

 
 

Repository files navigation

Laravel PostcodeApi

Build Status Total Downloads Latest Stable Version MIT Licensed

Installation

Install this package with composer:

composer require nickurt/laravel-postcodeapi

Copy the config files for the api

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

Examples

Default - en_AU

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

Default - en_GB

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

Default - en_US

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

Default - fr_FR

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

Default - nl_BE

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

Default - nl_NL

$postCode28 = PostcodeApi::create('ApiPostcode')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode29 = PostcodeApi::create('NationaalGeoRegister')->find('1118CP');
$postCode30 = PostcodeApi::create('NationaalGeoRegister')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode31 = PostcodeApi::create('PostcoDe')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode32 = PostcodeApi::create('PostcodeApiNu')->find('1118CP');
$postCode33 = PostcodeApi::create('PostcodeApiNu')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode34 = PostcodeApi::create('PostcodeData')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode35 = PostcodeApi::create('PostcodeNL')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode36 = PostcodeApi::create('PostcodesNL')->find('1118CP');
$postCode37 = PostcodeApi::create('PostcodesNL')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode38 = PostcodeApi::create('Pro6PP_NL')->find('1118CP');
$postCode39 = PostcodeApi::create('Pstcd')->find('1118CP');
$postCode40 = PostcodeApi::create('Pstcd')->findByPostcodeAndHouseNumber('1118CP', '202');

Route

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

Providers

AdresseDataGouv, Algolia, ApiPostcode, Bing, Geocodio, GeoPostcodeOrgUk, GetAddresIO, Google, Here, IdealPostcodes, LocationIQ, Mapbox, NationaalGeoRegister, OpenCage, postco.de, PostcodeApiComAu, PostcodeApiNu, PostcodeData, PostcodeNL, PostcodesIO, PostcodesNL, Pro6PP_BE, Pro6PP_NL, Pstcd, TomTom, UkPostcodes

Tests

composer test

About

Universal PostcodeApi for Laravel 6.x/7.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%