Skip to content

Commit 5769305

Browse files
author
Philipp Marien
committed
Merge branch 'release/4.0.0'
2 parents e901914 + bd56445 commit 5769305

File tree

10 files changed

+579
-570
lines changed

10 files changed

+579
-570
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: php
22

33
php:
44
- 7.2
5+
- 7.3
56

67
before_script:
78
- composer install

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,27 @@ Abstract client-side PHP implementation of the [json api specification](http://j
1010
composer require enm/json-api-client
1111
```
1212

13-
You can use the default HTTP implementation (`Enm\JsonApi\HttpClient\GuzzleAdapter`) which requires the Guzzle client.
13+
It's recommended to install `kriswallsmith/buzz` as http-client and `nyholm/psr7` for http factories.
1414

1515
```sh
16-
composer require guzzlehttp/guzzle ^6.0
16+
composer require kriswallsmith/buzz nyholm/psr7
1717
```
1818

19-
or the BuzzCurlAdapter (`Enm\JsonApi\HttpClient\BuzzCurlAdapter`) which requires the `kriswallsmith/buzz` client.
20-
21-
```sh
22-
composer require kriswallsmith/buzz ^0.16
23-
```
24-
25-
If needed you can also implement the interface by yourself to use any HTTP client which supports PSR-7.
19+
You can also use any HTTP client which implements [PSR-18](https://www.php-fig.org/psr/psr-18/).
2620

2721
## Usage
2822
First you should read the docs at [enm/json-api-common](https://eosnewmedia.github.io/JSON-API-Common/) where all basic structures are defined.
2923

30-
Your API client is an instance of `Enm\JsonApi\Client\JsonApiClient`, which requires a HTTP client (`Enm\JsonApi\HttpClient\HttpClientInterface`) to execute requests.
24+
Your API client is an instance of `Enm\JsonApi\Client\JsonApiClient`, which requires a PSR-18 HTTP client (`Psr\Http\Client\ClientInterface`) to execute requests.
3125

3226
```php
3327

3428
$client = new JsonApiClient(
3529
'http://example.com/api',
36-
new GuzzleAdapter(new Client()), // with guzzle in this example...
30+
$httpClient, // instance of Psr\Http\Client\ClientInterface
31+
$uriFactory, // instance of Psr\Http\Message\UriFactoryInterface
32+
$requestFactory, // instance of Psr\Http\Message\RequestFactoryInterface
33+
$streamFactory, // instance of Psr\Http\Message\StreamFactoryInterface
3734
new Serializer(),
3835
new Deserializer()
3936
);

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
}
2121
},
2222
"require": {
23-
"enm/json-api-common": "^3.0"
23+
"enm/json-api-common": "^3.0",
24+
"psr/http-factory": "^1.0",
25+
"psr/http-client": "^1.0"
2426
},
2527
"require-dev": {
26-
"phpunit/phpunit": "^7.0",
27-
"guzzlehttp/guzzle": "^6.0",
28-
"kriswallsmith/buzz": "^0.16.0"
28+
"phpunit/phpunit": "^8.3",
29+
"nyholm/psr7": "^1.2"
2930
},
3031
"minimum-stability": "stable"
3132
}

0 commit comments

Comments
 (0)