You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Client.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,13 +201,22 @@ $client->getContext(); // => currently used Phrity\Net\Context
201
201
### HTTP factories
202
202
203
203
By default the Client uses a minimal [PSR-7 HTTP message](https://www.php-fig.org/psr/psr-7/) implementation.
204
-
To use complete implementations such as `nyholm/psr7` or `guzzlehttp/psr7`, add their [PSR-17 HTTP factories](https://www.php-fig.org/psr/psr-17/) during setup.
204
+
Other (more complete) implementations can be used by setting [PSR-17 HTTP factories](https://www.php-fig.org/psr/psr-17/) on the CLient.
205
+
206
+
Set a configured HttpFactory class on the Client.
205
207
```php
206
-
$httpFactory = new Nyholm\Psr7\Factory\Psr17Factory(); // Or any other PSR-17 factory
207
-
$client
208
-
->setResponseFactory($httpFactory)
209
-
->setRequestFactory($httpFactory)
210
-
->setUriFactory($httpFactory);
208
+
$factory = new Phrity\Http\HttpFactory(
209
+
requestFactory: $myRequestFactory,
210
+
responseFactory: $myResponseFactory,
211
+
uriFactory: $myUriFactory,
212
+
);
213
+
$client->setHttpFactory($factory);
214
+
215
+
```
216
+
Or if you use factories that support multiple interfaces, available in libraries such as `nyholm/psr7` or `guzzlehttp/psr7`.
217
+
```php
218
+
$psrFactory = new Nyholm\Psr7\Factory\Psr17Factory(); // Or any other PSR-17 factory
Copy file name to clipboardExpand all lines: docs/Server.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,13 +192,22 @@ $server->getContext(); // => currently used Phrity\Net\Context
192
192
### HTTP factories
193
193
194
194
By default the Server uses a minimal [PSR-7 HTTP message](https://www.php-fig.org/psr/psr-7/) implementation.
195
-
To use complete implementations such as `nyholm/psr7` or `guzzlehttp/psr7`, add their [PSR-17 HTTP factories](https://www.php-fig.org/psr/psr-17/) during setup.
195
+
Other (more complete) implementations can be used by setting [PSR-17 HTTP factories](https://www.php-fig.org/psr/psr-17/) on the Server.
196
+
197
+
Set a configured HttpFactory class on the Client.
196
198
```php
197
-
$httpFactory = new Nyholm\Psr7\Factory\Psr17Factory(); // Or any other PSR-17 factory
198
-
$server
199
-
->setResponseFactory($httpFactory)
200
-
->setServerRequestFactory($httpFactory)
201
-
->setUriFactory($httpFactory);
199
+
$factory = new Phrity\Http\HttpFactory(
200
+
serverRequestFactory: $myServerRequestFactory,
201
+
responseFactory: $myResponseFactory,
202
+
uriFactory: $myUriFactory,
203
+
);
204
+
$server->setHttpFactory($factory);
205
+
```
206
+
207
+
Or if you use factories that support multiple interfaces, available in libraries such as `nyholm/psr7` or `guzzlehttp/psr7`.
208
+
```php
209
+
$psrFactory = new Nyholm\Psr7\Factory\Psr17Factory(); // Or any other PSR-17 factory
0 commit comments