OpenSwoole HTTP Request Object

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

The OpenSwoole\HTTP\Request object is passed to the Request event when running a OpenSwoole HTTP server and contains all the information of a HTTP request that was made to your OpenSwoole 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:

Last updated on September 16, 2022