Skip to content

Commit 2ed1bbf

Browse files
committed
Fix code examples in README.md, guzzlehttp/psr7 v2 now have a HttpFactory
1 parent 2fff09b commit 2ed1bbf

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ $client = new Redmine\Client\NativeCurlClient('https://redmine.example.com', '12
210210
The `Psr18Client` requires
211211

212212
- a `Psr\Http\Client\ClientInterface` implementation (like guzzlehttp/guzzle), [see](https://packagist.org/providers/psr/http-client-implementation)
213-
- a `Psr\Http\Message\ServerRequestFactoryInterface` implementation (like nyholm/psr7), [see](https://packagist.org/providers/psr/http-factory-implementation)
214-
- a `Psr\Http\Message\StreamFactoryInterface` implementation (like nyholm/psr7), [see](https://packagist.org/providers/psr/http-message-implementation)
213+
- a `Psr\Http\Message\ServerRequestFactoryInterface` implementation (like guzzlehttp/psr7), [see](https://packagist.org/providers/psr/http-factory-implementation)
214+
- a `Psr\Http\Message\StreamFactoryInterface` implementation (like guzzlehttp/psr7), [see](https://packagist.org/providers/psr/http-message-implementation)
215215
- a URL to your Redmine instance
216216
- an Apikey or username
217217
- and optional a password if you want tu use username/password.
@@ -223,13 +223,26 @@ The `Psr18Client` requires
223223

224224
require_once 'vendor/autoload.php';
225225
+
226-
+$guzzle = \GuzzleHttp\Client();
227-
+$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
226+
+$guzzle = new \GuzzleHttp\Client();
227+
+$psr17Factory = new \GuzzleHttp\Psr7\HttpFactory();
228228
+
229229
+// Instantiate with ApiKey
230-
+$client = new \Redmine\Client\Prs18Client($guzzle, $psr17Factory, $psr17Factory, 'https://redmine.example.com', '1234567890abcdfgh');
230+
+$client = new \Redmine\Client\Psr18Client(
231+
+ $guzzle,
232+
+ $psr17Factory,
233+
+ $psr17Factory,
234+
+ 'https://redmine.example.com',
235+
+ '1234567890abcdfgh'
236+
+);
231237
+// ...or Instantiate with Username/Password (not recommended)
232-
+$client = new \Redmine\Client\Prs18Client($guzzle, $psr17Factory, $psr17Factory, 'https://redmine.example.com', 'username', 'password');
238+
+$client = new \Redmine\Client\Psr18Client(
239+
+ $guzzle,
240+
+ $psr17Factory,
241+
+ $psr17Factory,
242+
+ 'https://redmine.example.com',
243+
+ 'username',
244+
+ 'password'
245+
+);
233246
```
234247

235248
##### Guzzle configuration
@@ -280,7 +293,7 @@ $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
280293
+};
281294
+
282295
// Instantiate with ApiKey
283-
$client = new \Redmine\Client\Prs18Client(
296+
$client = new \Redmine\Client\Psr18Client(
284297
- $guzzle,
285298
+ $guzzleWrapper,
286299
$psr17Factory,

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"require-dev": {
2727
"friendsofphp/php-cs-fixer": "^2.0",
2828
"phpunit/phpunit": "^9.5",
29-
"guzzlehttp/psr7": "^1.7",
29+
"guzzlehttp/psr7": "^2.0",
3030
"php-mock/php-mock-phpunit": "^2.6"
3131
},
3232
"autoload": {

0 commit comments

Comments
 (0)