Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\HTTP\Request->create(string $options): Swoole\Http\Request|false
An array of HTTP request options to set
Swoole\Http\Request or false
Create a new HTTP request object from scratch, this give you much more flexibility when passing the HTTP request object either to a downstream service or framework.
You are recreating the request object from Swoole\Http\Request
that was given to you from the server, not an actual new request.
Since version 4.6.0+
<?php
Swoole\HTTP\Request->create([
'parse_cookie' => true,
]);
Sets whether to resolve any HTTP cookies.
<?php
Swoole\HTTP\Request->create([
'parse_body' => true,
]);
Sets whether to resolve the HTTP POST body.
<?php
Swoole\HTTP\Request->create([
'parse_files' => true,
]);
Sets whether to resolve any HTTP files that were sent to the server.
<?php
Swoole\HTTP\Request->create([
'enable_compression' => true,
]);
Sets whether to enable compression or not.
<?php
Swoole\HTTP\Request->create([
'compression_level' => 1,
]);
Sets the compression level, from 1-9, the higher the smaller the request size but more CPU usage.