Swoole HTTP Request Object

The Swoole\HTTP\Request object is passed to the Request event when running a Swoole HTTP server and contains all the information of a HTTP request that was made to your Swoole server, for example, GET, POST, Cookies, files, headers etc.

The request object is passed to you so that you can interact with the server request and client information. You should not access this object via call-by-reference (use of the & symbol in PHP) because the object is destroyed afterwards and may lead to undefined object errors, only access it from the event callback, this object is only valid during the lifecycle of the server request, meaning, the request object is destroyed after the request has finished.

Class Properties and Methods

You can use the following properties and methods to access the HTTP request and data: