class RequestBridge

Methods

static Request
createFromSwoole(Request $swooleRequest)

Create an HttpFoundation request from a Swoole request.

transformHeaders(array $headers, array $server)

Build request headers directly while retaining Symfony's authorization aliases.

static array
transformServerParams(array $server, array $headers)

Transform Swoole's server params to $_SERVER style.

static array
transformFiles(array $files)

Transform Swoole's file uploads to UploadedFile instances.

static array
transformNestedFiles(array $files)

Transform nested file upload arrays (multi-file fields).

static string|null
extractPathInfo(array $server)

Extract the raw path from the Swoole request URI, which keeps its trailing slash as Laravel's does.

Details

at line 16
static Request createFromSwoole(Request $swooleRequest)

Create an HttpFoundation request from a Swoole request.

Parameters

Request $swooleRequest

Return Value

Request

at line 62
static protected RequestHeaderBag transformHeaders(array $headers, array $server)

Build request headers directly while retaining Symfony's authorization aliases.

Parameters

array $headers
array $server

Return Value

RequestHeaderBag

at line 120
static protected array transformServerParams(array $server, array $headers)

Transform Swoole's server params to $_SERVER style.

Swoole uses lowercase keys and splits headers from server vars. HttpFoundation expects $SERVER-style uppercase keys with HTTP prefix for headers.

Parameters

array $server
array $headers

Return Value

array

at line 175
static protected array transformFiles(array $files)

Transform Swoole's file uploads to UploadedFile instances.

Swoole provides files in $_FILES format. We construct UploadedFile objects with $test=true because Swoole's CLI SAPI means PHP's is_uploaded_file() and move_uploaded_file() don't recognize Swoole-received uploads. Symfony's $test flag makes isValid() skip is_uploaded_file() and move() use rename() instead of move_uploaded_file().

UploadedFile instances constructed here pass through FileBag unchanged because FileBag::convertFileInformation returns them as-is.

Parameters

array $files

Return Value

array

at line 201
static protected array transformNestedFiles(array $files)

Transform nested file upload arrays (multi-file fields).

Parameters

array $files

Return Value

array

at line 238
static protected string|null extractPathInfo(array $server)

Extract the raw path from the Swoole request URI, which keeps its trailing slash as Laravel's does.

Route matching trims trailing slashes itself, so the request keeps the target it arrived with for anything that reads it, such as URL signatures.

Parameters

array $server

Return Value

string|null