Skip to content

Commit 355b0ea

Browse files
author
Joris van de Sande
authored
Merge pull request #17 from LizZerrG/master
Get the postcode data by postcode.
2 parents 82fa77e + 77fef86 commit 355b0ea

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FHPostcodeAPIClient
33

44
[![Build Status](https://travis-ci.org/freshheads/FHPostcodeAPIClient.png?branch=master)](https://travis-ci.org/freshheads/FHPostcodeAPIClient)
55

6-
FHPostcodeAPIClient is a PHP client library for the PostcodeAPI.nu web service. This library is developed
6+
FHPostcodeAPIClient is a PHP client library for the PostcodeAPI.nu web service. This library is developed
77
by [Freshheads](https://www.freshheads.com) and will be maintained in sync with the web service itself.
88

99
**Links:**
@@ -14,7 +14,7 @@ by [Freshheads](https://www.freshheads.com) and will be maintained in sync with
1414
Requirements
1515
------------
1616

17-
FHPostcodeAPIClient works with PHP 5.5.0 or up. This library depends on the [HTTPPlug](http://httplug.io/), see http://docs.php-http.org/en/latest/httplug/introduction.html.
17+
FHPostcodeAPIClient works with PHP 5.5.0 or up. This library depends on the [HTTPPlug](http://httplug.io/), see http://docs.php-http.org/en/latest/httplug/introduction.html.
1818

1919
Installation
2020
------------
@@ -50,6 +50,7 @@ $client = new \FH\PostcodeAPI\Client(
5050
// call endpoints
5151
$response = $client->getAddresses('5041EB', 21);
5252
$response = $client->getAddress('0855200000061001');
53+
$response = $client->getPostcode('5041EB');
5354

5455
// Note that this call is only available with a premium account
5556
$response = $client->getPostcodes('51.566405', '5.077171');
@@ -64,7 +65,7 @@ composer require php-http/guzzle6-adapter
6465
Within Symfony project
6566
----------------------
6667

67-
We recommend to use [Guzzle](https://github.com/guzzle/guzzle), to be able to use Guzzle in combination with the PostcodeApiClient you should also make use of the
68+
We recommend to use [Guzzle](https://github.com/guzzle/guzzle), to be able to use Guzzle in combination with the PostcodeApiClient you should also make use of the
6869
[Guzzle6Adapter](https://github.com/php-http/guzzle6-adapter). By running the following command you automatically install Guzzle aswel.
6970

7071
```bash
@@ -82,7 +83,7 @@ project.http.adapter.guzzle.client:
8283
class: Http\Adapter\Guzzle6\Client
8384
arguments:
8485
- '@project.http.guzzle.client'
85-
86+
8687
project.client.postal_code:
8788
class: FH\PostcodeAPI\Client
8889
arguments:

lib/FH/PostcodeAPI/Client.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public function getAddress($id)
7171
return $this->get(sprintf('/addresses/%s', $id));
7272
}
7373

74+
/**
75+
* @param string $postcode
76+
*
77+
* @return \stdClass
78+
*/
79+
public function getPostcodeDataByPostcode($postcode)
80+
{
81+
return $this->get('/postcodes/' . $postcode);
82+
}
83+
7484
/**
7585
* @param string $latitude
7686
* @param string $longitude

0 commit comments

Comments
 (0)