Install this package with composer:
composer require nickurt/laravel-postcodeapi
Add the provider to config/app.php file
'nickurt\PostcodeApi\ServiceProvider',
and the facade in the file
'PostcodeApi' => 'nickurt\PostcodeApi\Facade',
Copy the config files for the api
php artisan vendor:publish --provider="nickurt\PostcodeApi\ServiceProvider" --tag="config"
$postCode10 = PostcodeApi::create('PostcodeApiComAu')->find('3066');
$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');
$postCode16 = PostcodeApi::create('Geocodio')->find('42370+Bob+Hope+Drive,+Rancho+Mirage+CA');
$postCode17 = PostcodeApi::create('AdresseDataGouv')->find('75007');
$postCode18 = PostcodeApi::create('AdresseDataGouv')->findByPostcodeAndHouseNumber('75007', '5 Avenue Anatole France');
$postCode19 = PostcodeApi::create('Pro6PP_BE')->find('1000');
$postCode20 = PostcodeApi::create('PostcodeApiNu')->find('1118CP');
$postCode21 = PostcodeApi::create('PostcodeApiNu')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode22 = PostcodeApi::create('PostcodeData')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode23 = PostcodeApi::create('PostcodeNL')->findByPostcodeAndHouseNumber('1118CP', '202');
$postCode24 = PostcodeApi::create('Pro6PP_NL')->find('1118CP');
$postCode25 = PostcodeApi::create('Pstcd')->find('1118CP');
$postCode26 = PostcodeApi::create('Pstcd')->findByPostcodeAndHouseNumber('1118CP', '202');
Route::get('/{postCode}', function($postCode) {
$postCode27 = PostcodeApi::create('PostcodeApiNu')->find($postCode);
return Response::json($postCode25->toArray(), 200, [], JSON_PRETTY_PRINT);
});
AdresseDataGouv, Geocodio, GeoPostcodeOrgUk, GetAddresIO, IdealPostcodes, PostcodeApiComAu, PostcodeApiNu, PostcodeData, PostcodeNL, PostcodesIO, Pro6PP_BE, Pro6PP_NL, Pstcd, UkPostcodes
phpunit