File tree Expand file tree Collapse file tree 1 file changed +67
-2
lines changed
Expand file tree Collapse file tree 1 file changed +67
-2
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments