Skip to content

Commit a62ffaf

Browse files
author
Evert Harmeling
authored
Merge pull request #21 from evertharmeling/develop
Minor READM, php version fix, service definition update + added ext-j…
2 parents 4ec44b0 + 02b0ba0 commit a62ffaf

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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 7.1 and 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
------------
@@ -72,22 +72,25 @@ We recommend to use [Guzzle](https://github.com/guzzle/guzzle), to be able to us
7272
composer require php-http/guzzle6-adapter
7373
```
7474

75-
And add the following service definitions:
75+
And add the following service definitions (usable in Symfony ^3.4):
7676
```yaml
77-
project.http.guzzle.client:
78-
class: GuzzleHttp\Client
79-
arguments:
80-
- { headers: { X-Api-Key: 'replace_with_your_own_api_key' } }
81-
82-
project.http.adapter.guzzle.client:
83-
class: Http\Adapter\Guzzle6\Client
84-
arguments:
85-
- '@project.http.guzzle.client'
86-
87-
project.client.postal_code:
88-
class: FH\PostcodeAPI\Client
89-
arguments:
90-
- '@project.http.adapter.guzzle.client'
77+
services:
78+
_defaults:
79+
autowire: true
80+
autoconfigure: true
81+
82+
project.http.guzzle.client:
83+
class: GuzzleHttp\Client
84+
arguments:
85+
- { headers: { X-Api-Key: 'replace_with_your_own_api_key_or_variable' } }
86+
87+
project.http.adapter.guzzle.client:
88+
class: Http\Adapter\Guzzle6\Client
89+
arguments:
90+
$client: '@project.http.guzzle.client'
91+
92+
FH\PostcodeAPI\Client:
93+
$httpClient: '@project.http.adapter.guzzle.client'
9194
```
9295
9396
You should now be able use the `project.client.postal_code` service to make requests to the PostcodeAPI.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1",
20+
"ext-json": "*",
2021
"php-http/httplug": "^2.0",
2122
"guzzlehttp/psr7": "^1.3"
2223
},

0 commit comments

Comments
 (0)