Skip to content

saryantosavin/laravel-postcodeapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel PostcodeApi

Installation

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"

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('Geocodio')->find('42370+Bob+Hope+Drive,+Rancho+Mirage+CA');

Default - fr_FR

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

Default - nl_BE

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

Default - nl_NL

$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

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

Providers

AdresseDataGouv, Geocodio, GeoPostcodeOrgUk, GetAddresIO, IdealPostcodes, PostcodeApiComAu, PostcodeApiNu, PostcodeData, PostcodeNL, PostcodesIO, Pro6PP_BE, Pro6PP_NL, Pstcd, UkPostcodes

Tests

phpunit

About

Universal PostcodeApi for Laravel 5.8

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%