File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments