Skip to content

Commit cc54365

Browse files
committed
Add documentation for always seekable body plugin
1 parent 70c64ec commit cc54365

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Always Seekable Body Plugin
2+
===========================
3+
4+
The ``AlwaysSeekableBodyPlugin`` ensure that body of the request and body of the response are always seekable.
5+
This allows a lot of components that read the stream to rewind it in order to be used later by another component::
6+
7+
use Http\Discovery\HttpClientDiscovery;
8+
use Http\Client\Common\PluginClient;
9+
use Http\Client\Common\Plugin\AlwaysSeekableBodyPlugin;
10+
11+
$options = [
12+
'use_file_buffer' => true,
13+
'memory_buffer_size' => 2097152,
14+
];
15+
$alwaysSeekableBodyPlugin = new AlwaysSeekableBodyPlugin($options);
16+
17+
$pluginClient = new PluginClient(
18+
HttpClientDiscovery::find(),
19+
[$alwaysSeekableBodyPlugin]
20+
);
21+
22+
The plugin supports the following options:
23+
24+
* ``use_file_buffer``: Whether it should use a temporary file to buffer the body of a stream if it's too big
25+
* ``memory_buffer_size``: Maximum memory to use for buffering the stream before it switch to a file

0 commit comments

Comments
 (0)