|
1 | | -# api-postcode-laravel |
2 | | -Laravel package for Api Postcode |
| 1 | +Laravel Api Postcode Package |
| 2 | +============================ |
| 3 | + |
| 4 | +A laravel package for fetching Address details |
| 5 | + |
| 6 | +For more information see [api-postcode](https://api-postcode.nl/) |
| 7 | + |
| 8 | +## Requirements ## |
| 9 | + |
| 10 | +Laravel 5.1 or later |
| 11 | + |
| 12 | + |
| 13 | +Installation |
| 14 | +------------ |
| 15 | +Installation is a quick 3 step process: |
| 16 | + |
| 17 | +1. Download api-postcode-laravelusing composer |
| 18 | +2. Enable the package in app.php |
| 19 | +3. Configure your Api Postcode credentials |
| 20 | + |
| 21 | +### Step 1: Download laravel-bitly using composer |
| 22 | + |
| 23 | +Add api-postcode/api-postcode-laravel by running the command: |
| 24 | + |
| 25 | +``` |
| 26 | +composer require api-postcode/api-postcode-laravel |
| 27 | +``` |
| 28 | + |
| 29 | +### Step 2: Enable the package in app.php |
| 30 | + |
| 31 | +Register the Service in: **config/app.php** |
| 32 | + |
| 33 | +``` php |
| 34 | +ApiPostcode\ApiPostcodeServiceProvider::class, |
| 35 | +```` |
| 36 | + |
| 37 | +### Step 3: Configure Api Postcode credentials |
| 38 | + |
| 39 | +``` |
| 40 | +php artisan vendor:publish |
| 41 | +``` |
| 42 | +
|
| 43 | +Add this in you **.env** file |
| 44 | +
|
| 45 | +``` |
| 46 | +API_POSTCODE_TOKEN=secret-token-from-api-postcode |
| 47 | +``` |
| 48 | +
|
| 49 | +Usage |
| 50 | +----- |
| 51 | +
|
| 52 | +``` php |
| 53 | +$address = app('api.postcode')->getAddress('1012JS', 1); |
| 54 | + |
| 55 | +$address->getStreet(); // Dam |
| 56 | +$address->getCity(); // Amsterdam |
| 57 | +$address->getHouseNumber(); // 1 |
| 58 | +$address->getZipCode(); // 1012JS |
| 59 | +$address->getLongitude(); // 4.4584 |
| 60 | +$address->getLatitude(); // 52.2296 |
| 61 | +```` |
0 commit comments