Skip to content

Commit 9d1c43a

Browse files
fix: guzzle requires special handling to enable streaming
1 parent 872590f commit 9d1c43a

10 files changed

Lines changed: 574 additions & 4 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ foreach ($stream as $response) {
258258
}
259259
```
260260

261+
Streaming requests are dispatched through a separate `streamingTransporter` PSR-18 HTTP client. When unset, the SDK uses the configured `transporter`.
262+
Some PSR-18 HTTP clients will by default try to read the entire response, so you may need to specify a streaming capable implementation.
263+
264+
```php
265+
$client = new Stagehand\Client(
266+
requestOptions: Stagehand\RequestOptions::with(streamingTransporter: $myStreamingClient),
267+
);
268+
```
269+
261270
### Handling errors
262271

263272
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Stagehand\Core\Exceptions\APIException` will be thrown:

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
},
3939
"require-dev": {
4040
"friendsofphp/php-cs-fixer": "^3",
41+
"guzzlehttp/guzzle": "^7",
4142
"nyholm/psr7": "^1",
4243
"pestphp/pest": "^3",
4344
"php-http/mock-client": "^1",

0 commit comments

Comments
 (0)