Skip to content

Commit 97cdfad

Browse files
authored
Update README.md
1 parent c922c0d commit 97cdfad

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
1-
# api-postcode-bundle
2-
Symfony Bundle for fetching Address details
1+
Api Postcode Bundle
2+
===================
3+
4+
This bundle can be useed to fetch Address details from zipcode with number.
5+
6+
Installation
7+
------------
8+
Installation is a quick 3 step process:
9+
10+
1. Download api-postcode-bundle using composer
11+
2. Enable the Bundle in AppKernel.php
12+
3. Configure Api Postcode credentials
13+
14+
### Step 1: Download postcode-bundle using composer
15+
16+
Add ApiPostcodeBundle by running the command:
17+
18+
``` bash
19+
$ composer require api-postcode/api-postcode-bundle
20+
```
21+
22+
### Step 2: Enable the Bundle in AppKernel.php
23+
24+
25+
``` php
26+
<?php
27+
// app/AppKernel.php
28+
29+
public function registerBundles()
30+
{
31+
$bundles = array(
32+
// ...
33+
new ApiPostcode\PostcodeBundle\ApiPostcodeBundle(),
34+
);
35+
}
36+
```
37+
38+
### Step 3: Configure Api Postcode credentials
39+
```yaml
40+
# app/config/config.yml
41+
42+
# Api Postcode Token
43+
api_postcode:
44+
token: secret-token
45+
46+
47+
```
48+
49+
Usage Services
50+
--------------
51+
``` php
52+
$address = $this->get('api.postcode')->getAddress('1012JS', 1);
53+
54+
$address->getStreet(); // Dam
55+
$address->getCity(); // Amsterdam
56+
$address->getHouseNumber(); // 1
57+
$address->getZipCode(); // 1012JS
58+
$address->getLongitude(); // 4.4584
59+
$address->getLatitude(); // 52.2296
60+
```
61+
62+
Usage from API
63+
--------------
64+
65+
Or try the API response:
66+
67+
http://127.0.0.1:8000/api/postcode?postcode=2011WD&nummer=2

0 commit comments

Comments
 (0)