Menu

Reference / Manticore\Sapi

requestBegin()

function
function requestBegin(
    array<string,string> $server = [],
    array<int|string,mixed> $get = [],
    array<int|string,mixed> $post = [],
    array<string,string> $cookie = [],
    array<int|string,mixed> $files = []
): void

Begin serving a request on the current flow: seed the request superglobals and start an empty response.

A server written on Async calls this with the parsed request, runs the handler, then calls {@see requestEnd}. $server is merged over the process $_SERVER, so CLI keys such as SCRIPT_NAME and argv stay visible. $_REQUEST is built GET-then-POST, php's default request order, and $_SESSION starts empty. While the request is live, header(), setcookie() and http_response_code() record into this flow's response.

Parameters

$server array<string,string> = []
entries merged over $_SERVER (REQUEST_URI, REQUEST_METHOD, HTTP_* ...)
$get array<int|string,mixed> = []
becomes $_GET; nested values for a[]=1 style input
$post array<int|string,mixed> = []
becomes $_POST
$cookie array<string,string> = []
becomes $_COOKIE
$files array<int|string,mixed> = []
becomes $_FILES

View source